Php preg_match for french characters

913 views Asked by At

Can anyone help me to write a preg_match to validate alpha characters and french accented characters also? So far I came up with:

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

There are 1 answers

0
Toto On BEST ANSWER

You could use unicode properties:

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

Where \p{L} stands for any letter.