note 20335 added to pcre.pattern.syntax
| From: | buracco at yahoo dot com | Date: | Sat, 30 Mar 2002 22:44:35 +0000 |
| Subject: | note 20335 added to pcre.pattern.syntax | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-28417@lists.php.net to get a copy of this message | ||
Say you have a pattern with 3 groups and want to replace 2nd.
i.e. (\w+=")(\d+)(")
preg_replace($pattern, "\$1$replacement\$3" ,$subject)
Works fine unless $replacement starts with a number. What to do then?
p.s.
When matching,
...If the pattern continues with a digit character, then some delimiter must be used to terminate
the back reference. If the PCRE_EXTENDED option is set, this can be whitespace. Otherwise an empty
comment can be used.comment can be used...
--
http://www.php.net/manual/en/pcre.pattern.syntax.php
http://master.php.net/manage/user-notes.php?action=edit+20335
http://master.php.net/manage/user-notes.php?action=delete+20335
http://master.php.net/manage/user-notes.php?action=reject+20335