|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-11-05 04:48 UTC] bretschneider at element5 dot com
Description:
------------
ereg does not seam to work with \x values.
it can only matches uppercase !! but \x21-\x7a
includes all upper and lower case characters.
for some reasons i must use ereg and NOT eregi.
preg_match does work! but it does not work with utf-8
Reproduce code:
---------------
$URLS = array(1 => 'FOUND',
2 => 'notfound');
$pattern = '[\x21-\x7a]+';
foreach ($URLS as $key => $url) {
print $url;
if (ereg($pattern, $url)) print " ............ OK\n";
else print " .............. FAILED\n";
}
Expected result:
----------------
FOUND ............ OK
notfound .............. OK
Actual result:
--------------
FOUND ............ OK
notfound .............. FAILED
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 06:00:01 2025 UTC |
Just change the quotes (') to double quotes (") for the $pattern var and this will work fine.