用于循环-Php preg_match用于法语字符


for loop - Php preg_match for french characters

有人能帮我写一个preg_match来验证字母字符和法语重音字符吗?到目前为止,我想出了:

'/^[-[:alpha:]''[:space:],_'/.]{2,30}$/ui'

您可以使用unicode属性:

preg_match("~[-'p{L}''s,_/.]{2,30}$~u", $string, $matches);

其中'p{L}代表任何字母。