如何修改字符串突变的正则表达式代码,使其也适用于重音字母?例如,reges 中“amor”的字符串突变应该与“āmōr”的突变相同。我试图简单地包含重音字母,例如 ´(?<=[aeiouāēīōūăĕĭŏŭ])´ 但这不起作用。
我的代码:
$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);