Difference between * and + regex

Each of them are quantifiers, the star quantifier(*) means that the preceding expression can match zero or more times it is like {0,} while the plus quantifier(+) indicate that the preceding expression MUST match at least one time or multiple times and it is the same as {1,} .

So to recap :

a*  ---> a{0,}  ---> Match a or aa or aaaaa or an empty string
a+  ---> a{1,}  ---> Match a or aa or aaaa but not a string empty

Leave a Comment