there are some similar questions out there, but none that are quite the same or that have an answer that works for me.
I need a javascript function which validates w
I'm using:
/^[A-z\u00C0-\u00ff\s'\.,-\/#!$%\^&\*;:{}=\-_`~()]+$/
as regular expression. I didn't test it with all the options but I've been using this for years and I never had any issue.
var regexp = /[A-z\u00C0-\u00ff]+/g,
ascii = ' hello !@#$%^&*())_+=',
latin = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏàáâãäåæçèéêëìíîïÐÑÒÓÔÕÖØÙÚÛÜÝÞßðñòóôõöøùúûüýþÿ',
chinese = ' 你 好 ';
console.log(regexp.test(ascii)); // true
console.log(regexp.test(latin)); // true
console.log(regexp.test(chinese)); // false
Glist: https://gist.github.com/germanattanasio/84cd25395688b7935182