Why doesnt my code pass tests 11 and 13?

Hello, I am attempting to use regex to pass test 11. I try to detect if the user has entered more than one . character and then replace the . characters with a single .
Please help me see where i’m going wrong.

Here is the link to my code: https://codesandbox.io/s/calculator-hrk8d?file=/src/App.js

I found a bit difficult to get into the code, but the calculator and errors were solved by using

      setCalc(calc.input.replace(/(^0)\1{2,}/, "0"));

Not sure if that solves all the issues, but yet there is an unmatched parenthesis therein (right before the 0)

Also, I would rewrite it like this: though I didn’t check that behaves as you expect.

Nice catch! Thank you!
Not the solution to the next test but i really appreciate this!

you’re welcome dude, keep it up

1 Like