php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23276 eregi() regexp trouble - very weird.
Submitted: 2003-04-18 19:53 UTC Modified: 2003-04-18 21:39 UTC
From: lukas at hej dot nu Assigned:
Status: Not a bug Package: Regexps related
PHP Version: 4.3.1 OS: Linux Slackware 8.1
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lukas at hej dot nu
New email:
PHP Version: OS:

 

 [2003-04-18 19:53 UTC] lukas at hej dot nu
This code:
<box bgcolor="#C6C6C6" bordercolor="#000000" top="1800" left="10" width="100" height="30" padding="5" borderwidth="1">

Won't match this RegExp in eregi():
<BOX bgcolor="(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow|#[0-9a-f]{6})" bordercolor="(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow|#[0-9a-f]{6})" top="([0-9]{1,3})" left="([0-9]{1,3})" width="([0-9]{1,3})" height="([0-9]{1,3})" padding="([0-9]{1})" borderwidth="([0-9]{1})">

It worked fine in PHP 4.2.x, but now in PHP 4.3.1 it doesn't.

An interesting notice might be that the code mentioned above will match this RegExp in eregi():
<BOX bgcolor="(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow|#[0-9a-f]{6})" bordercolor="(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow|#[0-9a-f]{6})" top="([0-9]{1,3})

Code example:
<?
if(eregi('<BOX bgcolor="(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow|#[0-9a-f]{6})" bordercolor="(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow|#[0-9a-f]{6})" top="([0-9]{1,3})" left="([0-9]{1,3})" width="([0-9]{1,3})" height="([0-9]{1,3})" padding="([0-9]{1})" borderwidth="([0-9]{1})">',
'<box bgcolor="#C6C6C6" bordercolor="#000000" top="1800" left="10" width="100" height="30" padding="5" borderwidth="1">'))
{
echo "Match";
}
else
{
echo "No match";
}
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-18 20:02 UTC] lukas at hej dot nu
This string:
<box bgcolor="#C6C6C6" bordercolor="#000000" top="1800" left="10"
width="100" height="30" padding="5" borderwidth="1">

Won't match this RegExp in eregi():
<BOX
bgcolor="(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purp
le|red|silver|teal|white|yellow|#[0-9a-f]{6})"
bordercolor="(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|
purple|red|silver|teal|white|yellow|#[0-9a-f]{6})" top="([0-9]{1,3})"
left="([0-9]{1,3})" width="([0-9]{1,3})" height="([0-9]{1,3})"
padding="([0-9]{1})" borderwidth="([0-9]{1})">

It worked fine in PHP 4.2.x, but now in PHP 4.3.1 it doesn't.

An interesting notice might be that the string mentioned above will match
this RegExp in eregi():
<BOX
bgcolor="(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purp
le|red|silver|teal|white|yellow|#[0-9a-f]{6})"
bordercolor="(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|
purple|red|silver|teal|white|yellow|#[0-9a-f]{6})" top="([0-9]{1,3})

Code example:
<?
if(eregi('<BOX
bgcolor="(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purp
le|red|silver|teal|white|yellow|#[0-9a-f]{6})"
bordercolor="(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|
purple|red|silver|teal|white|yellow|#[0-9a-f]{6})" top="([0-9]{1,3})"
left="([0-9]{1,3})" width="([0-9]{1,3})" height="([0-9]{1,3})"
padding="([0-9]{1})" borderwidth="([0-9]{1})">',
'<box bgcolor="#C6C6C6" bordercolor="#000000" top="1800" left="10"
width="100" height="30" padding="5" borderwidth="1">'))
{
echo "Match";
}
else
{
echo "No match";
}
?>
 [2003-04-18 20:07 UTC] lukas at hej dot nu
I thought I could change the original description, but it added a description instead. Well, all I wanted to change was "code" to "string".
 [2003-04-18 21:25 UTC] lukas at hej dot nu
I think everything was a stupid mistake :P
 [2003-04-18 21:26 UTC] lukas at hej dot nu
Well, it was. Sorry.
 [2003-04-18 21:39 UTC] magnus@php.net
On request.. 
Not a bug => Bogus 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC