Regular Expressions section

Have I missed something for this portion of the learning?
I have not seen any explanation on new RegEx and it was needed in some of the labs in this portion.

I struggled the most on this portion for understanding.
If I have missed sections within the learning that go over new RegEx please let me know thank you.

Hi @toothpick164,

Where are you at in the JavaScript curriculum? There is an entire section dedicated to Basic Regular Expressions starting with this theory lecture.

You can also add this Regular Expression Tester to your toolbelt to help you test regular expressions.

Happy coding!

Learning regex starts here.

Full Stack Curriculum → JavaScript certification → Basic Regex
The link above is the first theory.

Is that you are looking for?

We were trying to understand your question as it is missing some context.

What did you mean here? Which specific lab did you struggle with and what was the issue specifically?

Sorry for the late reply’s.
It was within the build a RegEx sandbox.
And specifically the RegExp objects.
I went through the forums when trying to complete this one and noticed all the ones i checked used RegExp. I could not find this explained within the theory portion. If i have missed it within the JavaScript Certification - Basic Regex section please let me know.

function checkPattern(){

  const flags = getFlags();

  //This line below here holding the RegExp
  const regex = new RegExp(regexPattern.value, flags);
  //I looked it up with MDN however ive preferred the way of explication within FCC


  let text = stringToTest.innerText;

  let matches = text.match(regex);

 

  if(!matches){

    testResult.innerText = "no match";

    stringToTest.innerHTML = text;

    return

  };

There are 7 regex lessons just before Build a Spam filter, Build a Palindrome Checker and Build a RegEx Sandbox. Do they help?

I went through those and i could not see the specific part for RegExp objects

The first lesson mentions Regex Objects. The example created is a regex object. The fact that you can perform the text() method on it would also suggest it’s an object. Having looked at MDN it seems there is also a constructor function. Can you say which specific part of the challenge is not mentioned in a lesson?

RegExp()

Specifically the use of this construct.
regex literals are mentioned however this specific construct is not mentioned from what i have seen.

Where in the Build a RegEx Sandbox task does it say to use the constructor function (I haven’t done the task so I don’t know).

It does not say to specifically use RegExp.
It was the only method I found that accounted for a not knowing/changing pattern.
In this instance “User input” that’s asking for different regex checks.
I was not able to get the normal.

const regex = /ab+c/

To give me the result needed to pass the lab.

You can report issues with the curriculum on Github (see below). If you say you weren’t able to solve this without using RegExp() which is not taught at that point, they may advise you if there is another way to solve it without.

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.