|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26134 ereg not working with hex regex
Submitted: 2003-11-05 04:48 UTC Modified: 2003-11-05 11:38 UTC
From: bretschneider at element5 dot com Assigned:
Status: Not a bug Package: Regexps related
PHP Version: 4.3.2 OS: freebsd
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
37 + 20 = ?
Subscribe to this entry?

 [2003-11-05 04:48 UTC] bretschneider at element5 dot com
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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-05 11:38 UTC]
Just change the quotes (') to double quotes (") for the $pattern var and this will work fine.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Feb 25 13:01:27 2024 UTC