ID: 28690 Updated by: [EMAIL PROTECTED] Reported By: swd120 at psu dot edu -Status: Open +Status: Feedback Bug Type: PCRE related Operating System: Windows XP, Apache 1.3 PHP Version: 5.0.0RC2 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.0-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [2004-06-08 03:42:31] swd120 at psu dot edu Description: ------------ PCRE Ungreedy flag does not work in PHP5 RC2 w32 distribution. same code on linux distro 4.37 does not duplicate same result. The flag remains greedy and doesn't replace the first value="ems" is replaces the 2nd one(technically it replaces all of it but i thought it would be easier to explain this way.) See source Reproduce code: --------------- $string='/(name="One".*value="ems")/Usi'; echo $string."<br>"; $content = 'One:<select name="One" id="One"> <option value=""> </option> <option value="picas">picas</option> <option value="ems">ems</option> <option value="exs">exs</option> <option value="%">%</option> </select> Two<select name="Two" id="Two"> <option value=""> </option> <option value="picas">picas</option> <option value="ems">ems</option> <option value="exs">exs</option> <option value="%">%</option> </select>'; $result = preg_match($string, $content); $replace ='\1 selected'; $um = preg_replace($string,$replace,$content); echo "matches: ".$result."<br>".$um; Expected result: ---------------- I expected value="ems" in the "one" select to become value="ems" selected. Actual result: -------------- value="ems" in the "two" select became value="ems" selected. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28690&edit=1