Match Numbers and Letters of the Alphabet wont pass correct code

For this lesson and the 2 before it wont pass my code even though its correct. after 10 mins trying to trouble shoot, I broke and looked at the hints given only to find that my code is exactly how it should be but I still don’t get to pass the test unless I copy paste the answer on to the page. I don’t like having to use the hints just to find out I am doing it right but I don’t get to pass.


A couple questions:

  • Can you maybe provide the challenge link and your code, that would be appreciated :slight_smile:
  • What browser are you using?
  • Do you have any extensions that have access to FCC?

let quoteSample = “Blueberry 3.141592653s are delicious.”;

let myRegex = /h-s2-6/gi; // Change this line

let result = quoteSample.match(myRegex); // Change this line

this is what wont pass, and here is the link for the challenge:

I am using chrome, and I am not sure about any extensions. I’ve allowed access to everything FCC has asked for.

Found my problem, I wasn’t adding square brackets[ ]

On this code right here, it doesn’t have the pattern expression, so it will only look for the specific things: h-s2-6 which is not in the the string. The pattern expression is the brackets [ ] anything you put inside it, will be looked up as a pattern. Your code isn’t really the same as the solution hint.

1 Like

I realized I forgot the square brackets after looking at another challenge, Thanks though!