note 17853 added to function.ereg-replace
| From: | rubein at earthlink dot net | Date: | Fri, 28 Dec 2001 22:31:12 +0000 |
| Subject: | note 17853 added to function.ereg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-23924@lists.php.net to get a copy of this message | ||
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.
--
http://www.php.net/manual/en/function.ereg-replace.php
http://master.php.net/manage/user-notes.php?action=edit+17853
http://master.php.net/manage/user-notes.php?action=delete+17853
http://master.php.net/manage/user-notes.php?action=reject+17853