#23276 [Csd->Bgs]: eregi() regexp trouble - very weird.

From: Date: Sat, 19 Apr 2003 02:39:17 +0000
Subject: #23276 [Csd->Bgs]: eregi() regexp trouble - very weird.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37890@lists.php.net to get a copy of this message
 ID:               23276
 Updated by:       magnus@php.net
 Reported By:      lukas at hej dot nu
-Status:           Closed
+Status:           Bogus
 Bug Type:         Regexps related
 Operating System: Linux Slackware 8.1
 PHP Version:      4.3.1
 New Comment:

On request.. 
Not a bug => Bogus 


Previous Comments:
------------------------------------------------------------------------

[2003-04-18 21:26:00] lukas at hej dot nu

Well, it was. Sorry.

------------------------------------------------------------------------

[2003-04-18 21:25:04] lukas at hej dot nu

I think everything was a stupid mistake :P

------------------------------------------------------------------------

[2003-04-18 20:07:56] 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 20:02:57] 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 19:53:45] 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";
}
?>

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=23276&edit=1



Thread (6 messages)

« previous php.bugs (#37890) next »