How can I modify my regex code for string mutations so that it also works for accented letters? For example a string mutation in reges for "amor" should be the same as the one for "āmōr". I tried to just simply include the accented letters like ´(?<=[aeiouāēīōūăĕĭŏŭ])´ but that did not work.
My code:
$hyphenation = '~
(?<=[aeiou]) #each syllable contain a vowel
(?:
# Muta cum liquida
( (?:[bcdfgpt]r | [bcfgp] l | ph [lr] | [cpt] h | qu ) [aeiou] x )
|
[bcdfghlmnp-tx]
(?:
# ct goes together
[cp] \K (?=t)
|
# two or more consonants are splitted up
\K (?= [bcdfghlmnp-tx]+ [aeiou])
)
|
# a consonant and a vowel go together
(?:
\K (?= [bcdfghlmnp-t] [aeiou])
|
# "x" goes to the preceding vowel
x \K (?= [a-z] | (*SKIP)(*F) )
)
|
# two vowels are splitted up except ae oe...
\K (?= [aeiou] (?<! ae | oe | au | que | qua | quo | qui ) )
)
~xi';
// hyphention
$result = preg_replace($hyphenation, '-$1', $input);