#21422 [NEW]: preg_match regexps not greedy by default

From: Date: Sun, 05 Jan 2003 07:37:07 +0000
Subject: #21422 [NEW]: preg_match regexps not greedy by default
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-29088@lists.php.net to get a copy of this message
From: astetson@aol.com Operating system: Linux PHP version: 4.3.0 PHP Bug Type: *Regular Expressions Bug description: preg_match regexps not greedy by default Perl regexps are greedy by default. \d+ will get all decimals possible (\d+? will only find one - it's lazy). It seems preg_match is not greedy by default. code: preg_match("/^\w+(\d+)$/", $change_link, $change_id); print("My ID is $change_id[1]<BR>"); when passed: "edit11" change_id[1] is equal to "1". It should be equal to "11" especially when my regexp is looking for the end of the line ($) after it! -- Edit bug report at http://bugs.php.net/?id=21422&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=21422&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=21422&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=21422&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=21422&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=21422&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=21422&r=support Expected behavior: http://bugs.php.net/fix.php?id=21422&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=21422&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=21422&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=21422&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21422&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=21422&r=dst IIS Stability: http://bugs.php.net/fix.php?id=21422&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=21422&r=gnused

« previous php.bugs (#29088) next »