#23276 [NEW]: eregi() regexp trouble - very weird.
| From: | lukas at hej dot nu | Date: | Sat, 19 Apr 2003 00:53:46 +0000 |
| Subject: | #23276 [NEW]: eregi() regexp trouble - very weird. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-37881@lists.php.net to get a copy of this message | ||
From: lukas at hej dot nu
Operating system: Linux Slackware 8.1
PHP version: 4.3.1
PHP Bug Type: Regexps related
Bug description: eregi() regexp trouble - very weird.
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 bug report at http://bugs.php.net/?id=23276&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23276&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23276&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23276&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23276&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23276&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23276&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23276&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23276&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23276&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23276&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23276&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23276&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23276&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23276&r=gnused