I'm trying to find a Regex, that matches no more than n consecutive, say three, for example, occurrences of a character; in the case of three and character is "a":
abbaa - matches;
ammaaa - doesn't match(three consecutive a's), there is one "a", but whole expression must be discarded because three "a's"
Thank you.
n
is1
, a simple question mark will suffice.a?
matches zero occurrences and one occurrence of the letter a. – Loupe