JS regex OR operator with Parentheses

I wanted to use an OR operator separate from the regex beginning and ending for this challenge, but I didn’t know that we have to place the operator inside parentheses in order for it to work.

let userCheck = /^[a-z]+([a-z]+|\d\d)\d*$/i;

So it took me REALLY long to complete the challenge because I didn’t learn about parentheses in the lesson:
** Match a Literal String with Different Possibilities **

I hope this info will be added in the lesson because I think it’s really important

Hello there,

If you look at the provided solution from the Get a Hint button, you will see there is no requirement for parentheses.

Hope this clarifies

1 Like

Right , there are many ways to solve the challenge.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.