From: drew at corrupt dot co dot nz Operating system: FreeBSD 4.9 PHP version: 4.3.5 PHP Bug Type: PCRE related Bug description: preg_match cant match ?
Description: ------------ I am trying to match a question mark in PHP using preg_match() with the following attempt's described in the code section. Neither work, while following documentation examples. Reproduce code: --------------- // String: $line = "This is pretty much a [url=\"http://www.wiki.org/?WhatIsAWIki\"]Wiki[/url] but with a twist of [BBCode] and a few other site specific [Hacks]"; // Attempt #1: preg_match_all("/\[(\/?[\w\d\-\_]+(=\"[\w\d\S\s\?]+?\")?)\]/",$line,$parse); print_r($parse); // Attempt #2: preg_match_all("/\[(\/?[\w\d\-\_]+(=\"[\w\d\S\s\\\?]+?\")?)\]/",$line,$parse); print_r($parse); Expected result: ---------------- I expected that the values "url=http://www.wiki.org/?WhatIsAWIki" and "http://www.wiki.org/?WhatIsAWIki" would be picked up from the regex into $parse. It works with the following PERL one liner: perl -e '$string = "This is pretty much a [url=\"http://www.wiki.org/?WhatIsAWIki\"]Wiki[/url] but with a twist of [BBCode] and a few other site specific [Hacks]"; @match = $string =~ m/\[(\/?[\w\d\-\_]+(=\"[\w\d\S\s\?]+?\")?)\]/; print "Match: " . join(",",@match) . "\n"' Match: url="http://www.wiki.org/?WhatIsAWIki",="http://www.wiki.org/?WhatIsAWIki" Actual result: -------------- Matches nothing. -- Edit bug report at http://bugs.php.net/?id=27949&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27949&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27949&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27949&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27949&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27949&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27949&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27949&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27949&r=support Expected behavior: http://bugs.php.net/fix.php?id=27949&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27949&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27949&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27949&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27949&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27949&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27949&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27949&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27949&r=float
