What regular expression do I need to check for some non-latin characters?
If you want to check the entire string use (in php)
preg_match('/^[\x{0000}-\x{007F}]*$/u',$s);
Just test for the presence of non-ascii characters instead of testing for the presence of ascii characters:
var foreignCharacters = $("#foreign_characters").val();
var rforeign = /[^\u0000-\u007f]/;
if (rforeign.test(foreignCharacters)) {
alert("This is non-Latin Characters");
} else {
alert("This is Latin Characters");
}
An alternative to making your own regex with code point ranges is to use the xregexp library
Some examples from the documentation:
XRegExp('^\\p{Hiragana}+$').test('ひらがな'); // -> true
XRegExp('^[\\p{Latin}\\p{Common}]+$').test('Über Café.'); // -> true