note 95985 deleted from regexp.reference.subpatterns by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 06:49:09 +0000 |
| Subject: | note 95985 deleted from regexp.reference.subpatterns by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-196655@lists.php.net to get a copy of this message | ||
Note Submitter: Chris
----
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');