views:

53

answers:

1

I'm currently trying to wrap my head around regex, I have a validation snippet that tests an input box against a regex-expression:

$.validator.addMethod("customerName", function(value, element){
return (/^[a-zA-Z]*$/).test(value);
}, "Some text");

That works well, but when I try to add a space and some special danish characters, it doesn't filter the danish characters, only the space.

$.validator.addMethod("customerName", function(value, element){
return (/^[a-zA-Z æøåÆØÅ]*$/).test(value);
}, "Some text");

Any ideas to what could be wrong?

A: 

Could it be a difference in character encoding, i.e. UTF-8 vs 8859-1?

hlovdal
Could be, I have a hunch that the HTML-file is encoded in iso-8859-1 and the js-file is encoded in UTF-8. Will try it out - thx a lot :D
timkl