Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect regex passes on negated character class #13

Open
ahrjarrett opened this issue Oct 12, 2016 · 1 comment
Open

incorrect regex passes on negated character class #13

ahrjarrett opened this issue Oct 12, 2016 · 1 comment

Comments

@ahrjarrett
Copy link

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.

@janeluck
Copy link

you are right, i got this problem too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants