It looks like Im the only one on this forum... its become a diary of sorts. Ok, after spending hours searching the web for help I finally came across the function to fix my problem... the stripslashes() function will pull out the slashes added as escapes. So, some working code if anyone is interested:
PHP Code:
<?php
// request Reg Exp if none has been provided
if (!isset($_GET['exp']) || !isset($_GET['test'])) {
$result = 'Please Enter an Expression and a Test String';
} else {
//test Reg Exp on String and return results
extract($_GET);
if (!preg_match('|' . stripslashes(trim($exp)) . '|',$test)){
$result = 'The test does not meet the expression criteria';
} else {
$result = 'This test meets the expression criteria';
}
}
?>
<html>
<head>
<title>Regular Expression Checker</title>
</head>
<body>
<h1>Test Your Regular Expression<h1/>
<h2> Input you expression and test string:<br/><br/></h2>
<form action="regexp.php" method="get">
<table>
<tr>
<td>Regular Expression:</td>
<td><input type="text" name="exp" value="<?php echo (isset($_GET['exp'])) ? stripslashes(trim($_GET['exp'])) : ''; ?>" /></td>
<td><small>Use preg_match() expression mechanisms;<br/> there is no need to use delimiting characters</small></td>
</tr><tr>
<td>Test</td>
<td><input type="text" name="test" value="<?php echo (isset($_GET['test'])) ? stripslashes($_GET['test']) : ''; ?>" /></td>
<td><input type="submit" name="submit" value="Test"></td>
</table>
</form>
<br/><br/>
<h2>Results:</h2>
<p> <?php echo $result; ?></p>
</body>
</html>
There are more robust expression checkers out there... but this works in a pinch.