note 95985 added to regexp.reference.subpatterns
| From: | Chris at osu1 dot php dot net | Date: | Mon, 01 Feb 2010 16:51:21 +0000 |
| Subject: | note 95985 added to regexp.reference.subpatterns | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-165571@lists.php.net to get a copy of this message | ||
For instance, one of my rewrite rules for a project I'm working on is "replace o with ö
if o is the next to last vowel and even numbered (counting left to right)"
So, an example is:
heabatoik would become heabatöik (o is the next to last vowel, as well as the 4th vowel)
habatoik would not change (o is the next to last vowel, but is the 3rd vowel)
$str = preg_replace(
'/^((?:[^aeiou]*[aeiou]){2})+' .
'([^aeiou]*[aeiou][^aeiou]*)' .
'o' .
'(?=[^aeiou]*[aeiou][^aeiou]*$)/',
'$1$2ö',
'heabatoik');
----
Server IP: 216.235.13.26
Probable Submitter: 24.102.36.185
----
Manual Page -- http://www.php.net/manual/en/regexp.reference.subpatterns.php
Edit -- https://master.php.net/note/edit/95985
Del: integrated -- https://master.php.net/note/delete/95985/integrated
Del: useless -- https://master.php.net/note/delete/95985/useless
Del: bad code -- https://master.php.net/note/delete/95985/bad+code
Del: spam -- https://master.php.net/note/delete/95985/spam
Del: non-english -- https://master.php.net/note/delete/95985/non-english
Del: in docs -- https://master.php.net/note/delete/95985/in+docs
Del: other reasons-- https://master.php.net/note/delete/95985
Reject -- https://master.php.net/note/reject/95985
Search -- https://master.php.net/manage/user-notes.php