note 17853 deleted from function.ereg-replace by kennyt
| From: | kennyt@php.net | Date: | Wed, 26 Jan 2005 03:57:34 +0000 |
| Subject: | note 17853 deleted from function.ereg-replace by kennyt | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-84000@lists.php.net to get a copy of this message | ||
Note Submitter: rubein at earthlink dot net
----
Quoth the docs: "If pattern contains parenthesized substrings, replacement may contain
substrings of the form \\digit, which will be replaced by the text matching the digit'th
parenthesized substring; \\0 will produce the entire contents of string. Up to nine substrings may
be used. Parentheses may be nested, in which case they are counted by the opening parenthesis."
This isn't ENTIRELY correct.
The substrings are merely a single slash (e.g. \0, \1, \2). However, when using double-quoted
strings it is neccessary to escape the slash (hence the double-slashing.) If you're using
single-quoted strings, using two backslashes won't work (a backslash within a single-quoted
string is treated literally unless you're escaping the single-quote character, i.e. \'),
you must use just one backslash.
"\\0" and '\0' are the same.