note 113352 added to regexp.reference.meta
| From: | ruben dot santacruz at gmail dot com | Date: | Mon, 30 Sep 2013 09:52:07 +0000 |
| Subject: | note 113352 added to regexp.reference.meta | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-196428@lists.php.net to get a copy of this message | ||
Note that if you want to match the dollar character and you are using a double quoted string for
defining the pattern, you should use \$ but you need to escape both the backslash and the dollar
sign itself.
This is because inside a double quoted string PHP will interpret the \$ sequence as a single $
character.
Example:
To match "$5.00" in "I owe you $5.00 exactly", the "/\$5\.00/" pattern
will become "/$5\.00" that it is not the desired pattern. It should be
"/\\\$5\.00/" that will become "/\$5\.00/".
My recommendation is to always keep this in mind or use single quoted strings, because single quotes
has less escape sequences interpreted.
----
Server IP: 69.147.83.199
Probable Submitter: 89.29.181.163
----
Manual Page -- http://php.net/manual/en/regexp.reference.meta.php
Edit -- https://master.php.net/note/edit/113352
Del: integrated -- https://master.php.net/note/delete/113352/integrated
Del: useless -- https://master.php.net/note/delete/113352/useless
Del: bad code -- https://master.php.net/note/delete/113352/bad+code
Del: spam -- https://master.php.net/note/delete/113352/spam
Del: non-english -- https://master.php.net/note/delete/113352/non-english
Del: in docs -- https://master.php.net/note/delete/113352/in+docs
Del: other reasons-- https://master.php.net/note/delete/113352
Reject -- https://master.php.net/note/reject/113352
Search -- https://master.php.net/manage/user-notes.php