note 51510 added to reference.pcre.pattern.syntax
| From: | onerob at gmail dot com | Date: | Sat, 02 Apr 2005 00:51:22 +0000 |
| Subject: | note 51510 added to reference.pcre.pattern.syntax | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-87332@lists.php.net to get a copy of this message | ||
If, like me, you tend to use the /U pattern modifier, then you will need to remember that using ? or
* to to test for optional characters will match zero characters if it means that the rest of the
pattern can continue matching, even if the optional characters exist.
For instance, if we have this string:
a___bcde
and apply this pattern:
'/a(_*).*e/U'
The whole pattern is matched but none of the _ characters are placed in the sub-pattern. The way
around this (if you still wish to use /U) is to use the ? greediness inverter. eg,
'/a(_*?).*e/U'
----
Manual Page -- http://www.php.net/manual/en/reference.pcre.pattern.syntax.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51510
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51510&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51510&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51510&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51510&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51510&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51510&report=yes
Search -- http://master.php.net/manage/user-notes.php