Sorry for being an absolute beginner, when it comes to Javascript and Regex,
I have a Codepen: http://ift.tt/2jJ4XhQ
What I want to accomplish is to validate, if a String contains some special UTF-8 characters. That's why I work with RegExp. The pattern I have here will return false only if the string to test equals one of the characters. But I want to return false if it contains one of these characters.
How can I accomplish this, I know it should be quite easy, but I wasn't able to get it working.
var regEx = new RegExp('[\u0001-\u00FF]');
console.log("This should be true: " + regEx.test("Tes"));
console.log("This should be false: " + regEx.test("Tes�"));
console.log("This returns false, because the string equals a special character: " + regEx.test("�"));
Aucun commentaire:
Enregistrer un commentaire