note 4326 modified in function.preg-match by irc-html
| From: | irc-html@php.net | Date: | Fri, 18 Jan 2002 19:47:07 +0000 |
| Subject: | note 4326 modified in function.preg-match by irc-html | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-25064@lists.php.net to get a copy of this message | ||
If you want to use some of PHP's special characters in your expression, such as $, you must
escape it twice. For example:
$matchme = "\$example";
if (preg_match("/\$example/", $matchme)) {
will not be matched because PHP interprets the \$ and passes it as $. Instead, you must do this:
if (preg_match("/\\\$example/", $matchme)) {
--was--
If you want to use some of PHP's special characters in your expression, such as $, you must
escape it twice. For example:
<PRE>$matchme = "\$example";
if (preg_match("/\$example/", $matchme)) {</PRE>
will not be matched because PHP interprets the \$ and passes it as $. Instead, you must do this:
<PRE>if (preg_match("/\\\$example/", $matchme)) {</PRE>
http://www.php.net/manual/en/function.preg-match.php