Ok, I am trying to make my life easier by constructing a SIMPLE script I can run locally here to test out my regular expressions.
I code it up, try it out and it does not work - it ALWAYS returns false.
Could someone look at my code and tell me where I am going wrong?
I thought it was the fact that my variables are stored in the $POST array, but when I do a print_r on the $POST, it prints out fine.
Where did I go astray?
IF(isset($_POST['submit']))
{
//set parameters and
//break string into tokens
$feederPattern = $_POST['expression'];
$flag = "FALSE";
$valueArray = str_split($_POST['stringy']);
$length = count($valueArray);
FOR($i = 0; $i < $length; $i++)
{
if(eregi('$feederPattern',"$valueArray[$i]"))
{
$flag = "TRUE";
}//end if
PRINT("{$valueArray[$i]}....Using Pattern $feederPattern....$flag<br />");
$flag = "FALSE";
}//end for loop
}//end if
PRINT("
<form method = 'post' action = 'reg_test.php'>
<h3>Regular Expression Tester</h3>
Regular Expression:<input type = 'text' name = 'expression' size = '45'>
<br /><br />
Check This String:<input type = 'text' name = 'stringy' size = '45'>
<br /><br />
<input type = 'submit' name = 'submit' value = 'CHECK'>
</form>
");