php.net |  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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bretschneider at element5 dot com
New email:
PHP Version: OS:

 

 [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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-05 11:38 UTC] sniper@php.net
Just change the quotes (') to double quotes (") for the $pattern var and this will work fine.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Nov 30 06:01:22 2020 UTC