Overview of Regular Expression Counting Quantifiers
Counting meta-characters, also known as standard quantifiers, specify how many times the preceding element should be matched. By default, these quantifiers use 'greedy' matching, meaning they match as many characters as possible.
Key constraints:
- Quantifiers only apply to the element immediately preceding them.
- Inside a character class
[], the characters*,+,?,., and|are treated as literal characters rather than meta-characters.
| Quantifier | Description | Equivalent To |
|---|---|---|
* | Matches 0 or more times | {0,} |
+ | Matches 1 or more times | {1,} |
? | Matches 0 or 1 time | {0,1} |
{min,max} | Matches between min and max times | N/A |