Regular Expressions - Match Characters that Occur One or More Times

Hi yall, can someone please explain the difference between using brackets and not using brackets please, from what i understood using the global g, and using brackets are both used for finding multiple matches?
Your code so far

let difficultSpelling = "Mississippi";
let myRegex = /ss+/g; // Change this line
let result = difficultSpelling.match(myRegex);

Your browser information:

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

Challenge: Regular Expressions - Match Characters that Occur One or More Times

Link to the challenge:

do you mean square brackets? or curly braces?
fyi, you can find a handy regex cheat sheet here:

/g is for finding all the matches (not just the first string to match)

1 Like

Yeah square brackets, i’m going to study over the linked page in a sec though thank you!

the square brackets don’t find multiple matches they just define a grouping (a character class) that you want to match

1 Like

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