Invalid preceding regular expression
| From: | phantom | Date: | Mon, 19 Nov 2001 11:18:19 +0000 |
| Subject: | Invalid preceding regular expression | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-75089@lists.php.net to get a copy of this message | ||
What is a << Warning: Invalid preceding regular expression >> mean when
running a page?
Output -----------------------------------
Warning: Invalid preceding regular expression in /ereg.php on line 4
PHP Page Source -------------------------
<%
function invalid_string($string,$valid) {
for ($i=0; $i<strlen($string); $i++) {
if (!ereg ($string[$i], $valid)) return true; \\Line
4;
}
return false;
}
if ($Action=="Submit") {
$validChars =
"1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";
$validAlphas = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";
$validNums = "1234567890";
if (invalid_string($Word,$validChars)) $Msg = "You entered a bad
word.";
else $Msg = "That word is acceptable.";
}
%>
<html>
<head>
<title>Ereg</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<%=$Msg;%><title>EREG</title>
<form name="form1" method="post" action="ereg.php">
Please enter a valid word only. Only alphanumeric characters! I dare
you to
try anything else.<br>
<input type="text" name="Word" size="20"
maxlength="20">
<input type="submit" name="Action" value="Submit">
</form>
</body>
</html>