Learn Form Validation by Building a Calorie Counter - Step 32

Tell us what’s happening:

I can’t do it, it just doesn’t work for me

Your code so far

const regex = /e[0-9]/i;
const regex = /e/[0-9]/e/i;
const regex = [0-9]/e/i;

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 32

What do the instructions say?

Number inputs only allow the e to occur between two digits. To match any number, you can use the character class [0-9]. This will match any digit between 0 and 9.

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

I think this is the important bit:

Can you give me an example? I have really tried in all the conventions and I can’t.

const regex = [0-9]e/i;
const regex = /e[0-9]i;

I would suggest resetting the lesson because there are some syntax errors

Here is your starting code from the lesson

const regex = /e/i;

do not create a new const variable called regex

edit the existing one they gave you.

You were on the right track here where you added the character class before the e

now you need to add the character class after the e

remember that your answer should only be one line of code not two

once you fix that, then it is will pass

I am not making two lines of code, I am giving examples of the ways in which I have defined regex, the truth is I don’t understand, I have put the possible ways, but I don’t understand, I don’t speak English, and I know it’s before but before like or at the end and at the beginning but at the end and at the beginning as
const regex = [0-9]/e/i;
const regex = /e/[0-9]/e/i;
const regex = e[0-9]e;
const regex = [0-9]/e/;
I don’t understand it, I really don’t understand it, I don’t know what they mean, I just don’t understand it.

combine what you did here

and here

The directions want you to add the character class before and after the e

Here is another example of adding a character class of xyz on each side of the letter p.

/[xyz]p[xyz]/i

You need to do something similar for this lesson

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