#46890 [NEW]: Regex works in perl, not with preg_match
| From: | gohanman at gmail dot com | Date: | Wed, 17 Dec 2008 20:51:06 +0000 |
| Subject: | #46890 [NEW]: Regex works in perl, not with preg_match | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-132100@lists.php.net to get a copy of this message | ||
From: gohanman at gmail dot com
Operating system: CentOS
PHP version: 5.2.8
PHP Bug Type: PCRE related
Bug description: Regex works in perl, not with preg_match
Description:
------------
I'm having a preg_match function fail periodically. I finally found a
specific input string that fails in PHP but works fine in Perl. I'm at a
loss why.
Reproduce code:
---------------
$pattern = "/(\w\w\w) (\d+) (\d\d\d\d) (\d+):(\d\d)(\w)M/";
$input = "Dec 17 2008 2:23PM";
$rv = preg_match($pattern, $input, $groups);
echo var_dump($rv);
Expected result:
----------------
A non-zero result indicating the pattern matched.
Actual result:
--------------
Zero.
--
Edit bug report at http://bugs.php.net/?id=46890&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46890&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46890&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46890&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46890&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46890&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=46890&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46890&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46890&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46890&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46890&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46890&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=46890&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=46890&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46890&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46890&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46890&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46890&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46890&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46890&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46890&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46890&r=mysqlcfg