Skip to content Skip to sidebar Skip to footer

How To Match Non-ascii (german, Spanish, Etc.) Letters In Regex?

I was unable to find or create a regex which match only letters,spaces, accented letters and spanish and german letters. I'm using this for now: var reg = new RegExp('^[a-z _]*$');

Solution 1:

I'm parsing a name input field, and this seems to be working for both German and French:

^[a-zA-Z\-ÀàÂâÆæÇçÈèÉéÊêËëÎîÏïÔôŒœÙùÛûÜü]*$

Some folks have names like 'Rölf-Dieter', and this lets them through, while checking for numbers. A little extreme, but it works!

Post a Comment for "How To Match Non-ascii (german, Spanish, Etc.) Letters In Regex?"