I am validating a street address with the following function which works fine for all English letters. But it does not accept these letters ö, Ö, ä, Ä. How can I change the following function so that it accepts these letters too?
validateAddress = function (val) {
var streetRegex = /^[\w+\s]+\d+,\s*[\s\w]+$/;
if (streetRegex.test(val)) return true;
else return false;
}
Modern browsers should be able to handle those characters in the regex. Check out this example on Chrome or Firefox.
But you can always convert those chars to ascii or unicode and use that instead: