Learn Form Validation by Building a Calorie Counter - Step 22

Tell us what’s happening:

I tried searching for the asnwer. but i dont get why it keeps on saying You should not escape the + character in your regular expression.

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

function cleanInputString(str) {
  const regex = /[\+-\s]/;
  
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 22

Hi,
The \ before + needs to be removed.
Good luck!

1 Like

thank you so much . it worked!