Learn Form Validation by Building a Calorie Counter - Step 19

Tell us what’s happening:

Stuck on what I’m supposed to do differently here. I have run the instructions through ChatGPT and searched the forums here and Google and couldn’t figure out what’s going on. Help is much appreciated! (First time posting. Let me know if I need to provide more info.)

" Regex in JavaScript is indicated by a pattern wrapped in forward slashes. The following example will match the string literal "hello":

* *const regex = /hello/;* *

Declare a regex variable and assign it the value from the example above. In future steps, you will update this regex pattern to match specific characters needed for the calorie counter."

function cleanInputString(str) {

};
let regex = /hello/;

// User Editable Region


### Your browser information:

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

### Challenge Information:
Learn Form Validation by Building a Calorie Counter - Step 19
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-form-validation-by-building-a-calorie-counter/step-19

By the way, I’ve tried const and let for all the following:

const regex = /hello/;
const regex = /“hello”/;
const regex = “/hello/”;

???

Hi there! Your regex variable is outside of the given function

AIEEE!! I can’t believe I didn’t try that. It didn’t specify to put it inside the function. Thanks so much! I’m still super duper new to JavaScript. :grin:

1 Like