Freecodecamp: Javascript: Sift through Text with Regular Expressions -- not accepting actual word pattern expression

Created on 30 Sep 2016  ·  3Comments  ·  Source: freeCodeCamp/freeCodeCamp

Challenge Name

Sift through Text with Regular Expressions
https://www.freecodecamp.com/challenges/sift-through-text-with-regular-expressions

Issue Description

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.

Code

var expression = /\band\b/gi;
var andCount = testString.match(expression).length;
help wanted

Most helpful comment

@erictleung If nobody else has worked on this yet, I'd like to make work on it and make a PR.

All 3 comments

@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.

Was this page helpful?
0 / 5 - 0 ratings