How do I match accented characters with PHP preg?

You could use Unicode character properties to describe the characters:

/^[\p{L}-]*$/u

\p{L} describes the class of Unicode letter characters.


What characters are considered "word-characters" depends on the locale. You should set a locale which has those characters in its natural alphabet, and use the /u modifier for the regexp, like this:

$str = 'perché';
setlocale(LC_ALL, 'it_IT@euro');
echo preg_match('#^\w+$#u', $str);

you can try with this regex:

$reg = '~[^\\pL\d]+~u';

which catch also accented characters