note 106074 added to regexp.reference.onlyonce
| From: | Esque at osu1 dot php dot net | Date: | Fri, 07 Oct 2011 19:04:04 +0000 |
| Subject: | note 106074 added to regexp.reference.onlyonce | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183716@lists.php.net to get a copy of this message | ||
(Just a guess) that should be happenning because (?>\D+) matches the whole string, so [!?]
doesn't find any matches, because the cursor is at the very end of the string. Using
look-behind assertion makes this pattern work:
preg_match("#((?>\D+)|<\d+>)*(?<=[!?])#", "aaaaaaaaaa!", $matches);
print_r($matches);
Array
(
[0] => aaaaaaaaaa!
[1] => aaaaaaaaaa!
)
----
Server IP: 69.147.83.197
Probable Submitter: 93.81.243.238
----
Manual Page -- http://www.php.net/manual/en/regexp.reference.onlyonce.php
Edit -- https://master.php.net/note/edit/106074
Del: integrated -- https://master.php.net/note/delete/106074/integrated
Del: useless -- https://master.php.net/note/delete/106074/useless
Del: bad code -- https://master.php.net/note/delete/106074/bad+code
Del: spam -- https://master.php.net/note/delete/106074/spam
Del: non-english -- https://master.php.net/note/delete/106074/non-english
Del: in docs -- https://master.php.net/note/delete/106074/in+docs
Del: other reasons-- https://master.php.net/note/delete/106074
Reject -- https://master.php.net/note/reject/106074
Search -- https://master.php.net/manage/user-notes.php