I need to prevent my users from entering non-european characters in a text box.
For example, here's how I disallow Cyrillic:
$('.test').keyup(function(e) {
var toTest = $(this).val();
var rforeign = /[\u0400-\u04FF]/i;
if (rforeign.test(toTest)) {
alert("No cyrillic allowed");
$(this).val('');
}
});
But I also need to exclude Arabic, Japanese, and so on.
I just want to allow:
- ASCII English, standard characters
- Italian accented letters: à è ì ò ù á é í ó ú
- other special characters from European languages: French, German...
Is there a way to do that with ranges?
I tried /[\u0400-\u04FF]/i
but it just allows ASCII English (not Italian for example).