I’d like to give my users the option to not only fill in letters and numbers, but also “special” letters like the “á”, “é”, etc. However, I do not want them to be able to use symbols like “!”, “@”, "%”, etc.
Is there a way to write a regex to accomplish this? (Preferably without specifying each special letter.)
Now I have:
$reg = '/^[\w\-]*$/';
You could use Unicode character properties to describe the characters:
/^[\p{L}-]*$/u
\p{L}
describes the class of Unicode letter characters.