https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead
What is the problem with this? I try it with Regexr and I match every test.
^[A-Z](?=\w{5,})(?=\D*\d)$/i
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead
What is the problem with this? I try it with Regexr and I match every test.
^[A-Z](?=\w{5,})(?=\D*\d)$/i
Your regex should use two positive
lookaheads
.
Don’t use the g
flag with test
method (you can look at the documentation on the why)