Quantifiers Flashcards
*
Match 0 or more times. Example: ab* matches a, ab, abb, abbb etc.
?
Match 0 or 1 times. Example: ab? matches a and ab
+
Match 1 or more times. Example: ab+ matches ab, abb, abbb etc.
{n}
Match exactly n times. Example: ab{2} matches abb
{n,}
Match n or more times. Example: ab{2,} matches abb, abbb, abbbb etc.
{n,m}
Match at least n times, but no more than m times. Example: ab{2,3} matches abb and abbb
??
Match 0 or 1 times, but as few times as possible. Example: ab?? against abbbbb matches a
*?
Match 0 or more times, but as few times as possible. Example: ab*? against abbbbb matches a
+?
Match 1 or more times, but as few times as possible. Example: ab+? against abbbbb matches ab
{n}?
Match n or more times, but as few times as possible. Example: ab{2}? against abbbbb matches abb
{n,m}?
Match at least n times, no more than m times, but as few times as possible. Example: ab{2,3}? against abbbbb matches abb