note 20890 deleted from function.ereg-replace by kennyt
| From: | kennyt@php.net | Date: | Wed, 26 Jan 2005 03:56:28 +0000 |
| Subject: | note 20890 deleted from function.ereg-replace by kennyt | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-83994@lists.php.net to get a copy of this message | ||
Note Submitter: php-manual at leon dot brooks dot fdns dot net
----
Little gotcha with multiple-match regexps (that is, a|b|c): the parenthesised sub-expressions
don't `reset' when crossing a | - for example in a(a)a|b(b)b|c(c)c the (a) is \1, the (b)
is \2 and the (c) is \3 rather than all being \1. Perhaps it's just too late at night, but
that's how I expected it to work: as in, I expected to be able to hunt for multiple |-separated
expressions with one call to ereg (or whatever) and have them all pop into the one result array
element as $result[1] but instead I need multiple calls to ereg() (or whatever) over the same
string.