Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWWDillingham WesleyDillingham <wwdillingham@sugarlabs.org>2009-07-07 01:03:23 (GMT)
committer WWDillingham WesleyDillingham <wwdillingham@sugarlabs.org>2009-07-07 01:03:23 (GMT)
commit37006d9d0070ecb0cdaef0e1146058a537cd726a (patch)
treea989778c7151944ca8f178cd9980c49d9edfb863
parent6007226e37b067be9bc0c672bede2f404c552db5 (diff)
Incorporated updated regex into the operations
-rw-r--r--order_of_operations_parser.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/order_of_operations_parser.php b/order_of_operations_parser.php
index f4525db..9382497 100644
--- a/order_of_operations_parser.php
+++ b/order_of_operations_parser.php
@@ -77,7 +77,7 @@ for (i=0;i<=$numRecords;i++)
//contains addition
- $regexp = "+";
+ $regexp = "/\+/";
if (preg_match($regexp, $equation)) //if ($tok[2] contains TODO check for correctness
{
$contains_addition[tok[0]]++; //but is not correct
@@ -108,7 +108,7 @@ for (i=0;i<=$numRecords;i++)
//TODO: account for negative numbers
//contains subtraction
- $regexp = "-"; //NOTE:operation remains the same, as we are checking it four times for each operation
+ $regexp = "/[0-9]\-[0-9]/"; //NOTE:operation remains the same, as we are checking it four times for each operation
if (preg_match($regexp, $equation))
{
$contains_subtraction[tok[0]]++;
@@ -132,7 +132,7 @@ for (i=0;i<=$numRecords;i++)
//******************************DIVISION********************************
//contains division
- $regexp = "\/"
+ $regexp = "/\//"
if (preg_match($regexp, $equation))
{
$contains_division[tok[0]]++
@@ -157,7 +157,7 @@ for (i=0;i<=$numRecords;i++)
//**************************************Multiplication*************************
- $regexp = "*" //Matches equations with only multiplication
+ $regexp = "/\*/" //Matches equations with only multiplication
if (preg_match($regexp, $equation))
{
$contains_multiplication[tok[0]]++;