Problem 221 - Sift through Text with Regular Expressions


Hi all,
Maybe I am being just too thick at this moment, but I am not understanding Problem 221 - ‘Sift through Text with Regular Expressions.’ I am totally at a loss for what they are asking for. I am not even sure where to begin… :frowning:

I know this sounds a little off but could someone spell out the answer or re-word the question so that I may better understand. I am not usually so thick. :slight_smile:

ALSO, I have thought of an added function that FCC could do. FCC could add a button to alert the programmers that a question is not clear, so that they may track ‘problem’ questions and consider re-wording them in future additions.



The only line of code you have to modify is:

var expression = /./gi;  // Change this Line

The second sentence in the instructions tell you exactly what to do:

Select all the occurrences of the word and in testString.

You can do this by replacing the . part of the regular expression with the word and.

Just replace the . with the word and


Interesting, I was adding ‘and+’ which was throwing me off. I must have read too much into the question by adding the ‘+’.

‘Light dawns on Marble Head’ ;))