Comment puis-je tester si un RegEx correspond à une chaîne exactement?Chaîne exacte avec JavaScript
var r = /a/;
r.test("a"); // returns true
r.test("ba"); // returns true
testExact(r, "ba"); // should return false
testExact(r, "a"); // should return true
Avez-vous eu l'intention d'écrire "var r = /./;"? – Prestaul
J'avais l'intention d'écrire/a/(: merci –
Possible copie de [Regex - Match chaîne entière] (http://stackoverflow.com/questions/6298566/regex-match-whole-string) – Vadzim