ID: 48589 Updated by: fel...@php.net Reported By: mjs at beebo dot org -Status: Open +Status: Bogus Bug Type: PCRE related Operating System: OS X PHP Version: 5.2.9 New Comment:
No bug there, the '$z' enclosed by double quotes is interpreted as a variable first. http://docs.php.net/manual/en/language.types.string.php Previous Comments: ------------------------------------------------------------------------ [2009-06-17 20:45:19] mjs at beebo dot org Regexp documentation: http://php.net/manual/en/regexp.reference.php ------------------------------------------------------------------------ [2009-06-17 20:23:44] mjs at beebo dot org Description: ------------ The regular expression /\Q$z\E/ matches (as far as I can tell) every string. It certainly matches some strings it shouldn't match: preg_match("/\Q$z\E/", "") -> MATCH (WRONG!) preg_match("/\Q$z\E/", "qqqq") -> MATCH (WRONG!) preg_match("/\Q $z\E/", "qqqq") -> NO MATCH (CORRECT) preg_match("/\Q $z\E/", " $z") -> MATCH (CORRECT) preg_match("/\Q\$z\E/", "\$z") -> MATCH (CORRECT) preg_match("/\Q\$z\E/", "$z") -> NO MATCH (CORRECT) The problem seems to occur if the regular expression begins with the string "\Q$" followed by at least one character. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48589&edit=1