I am looking for a method for the jquery validate plugin (http://bassistance.de/jquery-plugins/jquery-plugin-validation/), that only accepts letters, including the German so called Umlaute (öäüÖÄÜß).. I googled a bit, but unfortunately couldn’t find anything. I’m not good with regex, so I failed writing my own rule..
Do you have any idea? Any help is appreciated! Thx in advance! 🙂
Here is my method so far:
jQuery.validator.addMethod("lettersonly", function(value, element) {
return this.optional(element) || /^[a-zA-ZüöäÜÖÄß]+$/i.test(value);
}, "Letters only please");
SOLUTION: The method works! The problem was that the meta tag “content-type” was set wrong to ISO, but it has to be UTF-8 of course. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
These are the unicode characters for german letters, including the normal letters.
And this is normal :
It depends on what your input is.
The above matches single letters. Since you provide no sample input we can’t make the regex rule more specific!