Sift through Text with Regular Expressions
https://www.freecodecamp.com/challenges/sift-through-text-with-regular-expressions
The instructions clearly state
Select all the occurrences of the word _and_ in _testString_.
Hence i think the following regex /\band\b/gi
or /(?:\b)and(?:\b)/gi
where one actually considers the word boundaries in the expression should also be a valid answer, not just /and/gi
.
Sorry if this a duplicate (and it probably is), but definitely should be fixed IMHO. Could turn down some dedicated beginners.
var expression = /\band\b/gi;
var andCount = testString.match(expression).length;
@decksterr thanks for the issue. I agree that the tests should be better at allowing other regular expression patterns that solve the challenge.
@erictleung If nobody else has worked on this yet, I'd like to make work on it and make a PR.
@newyork-anthonyng, you can work on that.
Most helpful comment
@erictleung If nobody else has worked on this yet, I'd like to make work on it and make a PR.