# Learn Form Validation by Building a Calorie Counter - Step 32

**URL:** <https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-32/673540>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [February 19, 2024, 2:39pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-32/673540 "2024-02-19T14:39:02Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mediaalanegra](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/mediaalanegra/32/348781_2.png) [@mediaalanegra](https://forum.freecodecamp.org/u/mediaalanegra)\
**Post date:** [February 19, 2024, 2:39pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-32/673540/1 "2024-02-19T14:39:02Z")

</div>

### Tell us what’s happening:

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

### Your code so far

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

```

```auto
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.

````plaintext
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

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-form-validation-by-building-a-calorie-counter/step-32)**
>
> Learn to Code — For Free

---

<div class="post-metadata">

**Author:** ![ambradnum](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ambradnum/32/241667_2.png) [@ambradnum](https://forum.freecodecamp.org/u/ambradnum)\
**Post date:** [February 19, 2024, 2:40pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-32/673540/2 "2024-02-19T14:40:38Z")

</div>

What do the instructions say?

---

<div class="post-metadata">

**Author:** ![mediaalanegra](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/mediaalanegra/32/348781_2.png) [@mediaalanegra](https://forum.freecodecamp.org/u/mediaalanegra)\
**Post date:** [February 19, 2024, 2:49pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-32/673540/3 "2024-02-19T14:49:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ambradnum](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ambradnum/32/241667_2.png) [@ambradnum](https://forum.freecodecamp.org/u/ambradnum)\
**Post date:** [February 19, 2024, 6:11pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-32/673540/4 "2024-02-19T18:11:22Z")

</div>

I think this is the important bit:

> [@mediaalanegra](#):
>
> Add this character class before and after `e` in your pattern

---

<div class="post-metadata">

**Author:** ![mediaalanegra](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/mediaalanegra/32/348781_2.png) [@mediaalanegra](https://forum.freecodecamp.org/u/mediaalanegra)\
**Post date:** [February 19, 2024, 7:55pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-32/673540/5 "2024-02-19T19:55:43Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![jwilkins.oboe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jwilkins.oboe/32/179497_2.png) [@jwilkins.oboe](https://forum.freecodecamp.org/u/jwilkins.oboe)\
**Post date:** [February 19, 2024, 8:14pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-32/673540/6 "2024-02-19T20:14:10Z")

</div>

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

Here is your starting code from the lesson

```js
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

> [@mediaalanegra](#):
>
> `[0-9]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

---

<div class="post-metadata">

**Author:** ![mediaalanegra](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/mediaalanegra/32/348781_2.png) [@mediaalanegra](https://forum.freecodecamp.org/u/mediaalanegra)\
**Post date:** [February 19, 2024, 11:49pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-32/673540/7 "2024-02-19T23:49:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jwilkins.oboe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jwilkins.oboe/32/179497_2.png) [@jwilkins.oboe](https://forum.freecodecamp.org/u/jwilkins.oboe)\
**Post date:** [February 20, 2024, 12:14am UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-32/673540/8 "2024-02-20T00:14:12Z")

</div>

combine what you did here

> [@mediaalanegra](#):
>
> [0-9]/e

and here

> [@mediaalanegra](#):
>
> `e[0-9]`

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`.

```js
/[xyz]p[xyz]/i

```

You need to do something similar for this lesson

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [August 20, 2024, 12:14pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-32/673540/9 "2024-08-20T12:14:56Z")

</div>

Closed on August 20, 2024, 12:14pm UTC

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