Match Characters that Occur Zero or More Times HELP

now im even more confused lol. i just wanna know what quantifier means the star symbol β€œ*”

One of the best tools you can experiment with is regex101.com

1 Like

but it doesn’t explain to me how the concept works with the quantifier

string -> Aa
regex -> A{3}

matches: 0
why? you dont have AAA. The 3 is the quantifier. As in how many.

string -> AAbbb
regex -> A{2}

matches: 1
why? Because your string has AA

These are different regexes: A{3} , A{4}, A{9}
Your string would have to have AAA or AAAA or AAAAAAAAA. (exact matches)

But say you willing to accept a range?
string -> AAAA
regex -> A{1,4}
matches: 1
why? because the 1 means a mininum of 1 A and the 4 means a max of 4 As.

string -> BBCCC
regex -> C{0,}
matches: 1
why? because your β€˜C’ matches and you need at least 0 matches of it or more. (It’s more because the 2nd number is missing in {0,}

So if you understand this concept,. then you will understand what * means. Because * means {0,}

1 Like

The point of the link is so you can experiment with different strings with different regexes.