Robin Vickery schrieb:
On 01/06/06, Merlin <ngroups@xxxxxxxxxxx> wrote:
Hi there,
I do work on following regex:
^(.*)_a[0-9](.*).htm$
This should be valid for "test_a9393.htm", but not for "9393.htm" as
ther is no leading _a infront of the number.
Unfortunatelly this also works for the 9393.htm file. Can somebody give
me a hint why the regex also is true for text that does not start with
_a infront of the number?
It won't match something without an _a in it. So there's something
you're not mentioning.
<?php
$test = array('test_a9393.htm','a9393.htm');
foreach ($test as $t) {
print preg_match('/^(.*)_a[0-9](.*).htm$/', $t) ?
"'$t' matches.\n" :
"'$t' does not match.\n";
}
?>
'test_a9393.htm' matches.
'a9393.htm' does not match.
-robin
Thank you robin! That saved my ass :-) Actually my regex was quit fine,
the problem was that there was a search function searching for
is_numeric that was redirecting to another page *lol*
Best regards, Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php