Learn Form Validation by Building a Calorie Counter - Step 31

Tell us what’s happening:

function isInvalidInput(str) {
const regex = /[0-9]e/i;
}
I get an error message saying "You should add the [0-9] character class after ‘e’ in your regular expression. After I changed it I get vise versa error (ie. [0-9] should be BEFORE ‘e’). Idk what I’m missing. Tried adding ‘e’ at the beginning and end.

Your code so far

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

/* file: styles.css */

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

function isInvalidInput(str) {
  const regex = /[0-9]e/i;
}

// 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/126.0.0.0 Safari/537.36

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 31

Add this character class before and after e in your pattern.

Before and after the e

only allow the e to occur between two digits

digit, e, digit

2 Likes

thanks that worked a treat for me this is confusing until you do exactly as you say digit e digit no commas needed thanks. before and after the e

1 Like

I wasn’t reading it all the way. lol.

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