#41077 [NEW]: Order may matter between brackets
| From: | aeolianmeson at blitzeclipse dot com | Date: | Fri, 13 Apr 2007 15:07:41 +0000 |
| Subject: | #41077 [NEW]: Order may matter between brackets | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-111454@lists.php.net to get a copy of this message | ||
From: aeolianmeson at blitzeclipse dot com
Operating system: 2000 Server
PHP version: 5.2.1
PHP Bug Type: *Regular Expressions
Bug description: Order may matter between brackets
Description:
------------
I needed to add a dash to a character class, so I appended it to the
present character class definition. It turns out that it wouldn't accept
unless I moved it to the middle.
Reproduce code:
---------------
// This works.
// $reg = "^[[:alnum:]_\.\-]+@[[:alnum:]_\.\-]+$";
// This does not work. The only difference
// is the order of the last two accepted
// characters in the first character class.
$reg = "^[a-z0-9_\-\.]+@[[:alnum:]_\.\-]+$";
var_dump(ereg($reg, 'ab-c@def.com'));
Expected result:
----------------
Does match.
Actual result:
--------------
Does not match.
--
Edit bug report at http://bugs.php.net/?id=41077&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41077&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41077&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41077&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41077&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=41077&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41077&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41077&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41077&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41077&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41077&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=41077&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=41077&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41077&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41077&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41077&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41077&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41077&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41077&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41077&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41077&r=mysqlcfg