note 20890 added to function.ereg-replace
| From: | php-manual at leon dot brooks dot fdns dot net | Date: | Sat, 20 Apr 2002 17:07:42 +0000 |
| Subject: | note 20890 added to function.ereg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-29608@lists.php.net to get a copy of this message | ||
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.
--
http://www.php.net/manual/en/function.ereg-replace.php
http://master.php.net/manage/user-notes.php?action=edit+20890
http://master.php.net/manage/user-notes.php?action=delete+20890
http://master.php.net/manage/user-notes.php?action=reject+20890