Extract Matches1

Extract Matches1
0

#1

Tell us what’s happening:

WHERE IS WRONG?

Your code so far


let extractStr = "Extract the word 'coding' from this string.";
let codingRegex = /change/; // Change this line
myStr.match(codingRegex); // Change this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/extract-matches


#2

The word is not /change/, it is /coding/.


#4

myStr is not defined
myStr is not defined
myStr is not defined

I changed it but tell that above this line.


#5

Also you need to apply the match function to extractStr and not to mystr which isn’t defined, like this:

extractStr.match(codingRegex);

#6

I do it but again tell me that:
result is not defined

And my code is:
let extractStr = “Extract the word ‘coding’ from this string.”;
let codingRegex = /coding/; // Change this line
extractStr.match(codingRegex); // Change this line


#7

When you see this, that means you have attempted to use a variable which has not been declared in your code.


#8

The original code had a variable declared named result. Put that declaration back in.


#9

Assign extractStr.match(codingRegex) to result:

let result = extractStr.match(codingRegex);

#10

Yeeesss thank you this isn’t so hard:grinning::grinning:


#11

That’s right! :grinning::+1: