Regex is not recognized.
Here are the instructions:
Step 74
In your
highPrecedence
function, declare aregex
variable. Assign it a regular expression that matches a number (including decimal numbers) followed by a*
or/
operator followed by another number.Each number, and the operator, should be in separate capture groups.
Here is my code:
const highPrecedence = str => {
const regex = /([\d.]+)(\*|\/)([\d.]+)/;
}
The first group (and therefore the third one) works perfectly.
The problem is with the second (middle) group.
Instructions ask to capture the star (multiplication) operator or the division operator. These two characters are special so I escaped them.
I don’t understand why I get this error message:
Sorry, your code does not pass. Hang in there.
Your second capture group should match a
*
or/
operator. Use a character class in the capture group.
I’ve tried many combinations:
(\*)|(\/)
([\*|\/])
([\*]|[\/])
None of them work