regex-adventure icon indicating copy to clipboard operation
regex-adventure copied to clipboard

incorrect regex passes on negated character class

Open ahrjarrett opened this issue 8 years ago • 1 comments

in module #5 titled "negated character class", the tests don't cover an incorrect answer.

//CORRECT ANSWER: module.exports = function (str) { return /^[^0-9][^A-Z]/.test(str) }

//INCORRECTLY ACCEPTS: module.exports = str => /[^0-9][^A-Z]/.test(str)/

//AND: module.exports = str => /\D[^A-Z]/.test(str)

that means that the string does not have to start with a non-digit, just contain this sequence of two numbers somewhere within it.

ahrjarrett avatar Oct 12 '16 06:10 ahrjarrett

you are right, i got this problem too

janeluck avatar Oct 20 '16 13:10 janeluck