Latest News

the latest news from our team

Quantifiers

Quantifiers specify the number of instances a character or character class must be present in the input for a match to be found. Quantifiers can be greedy or lazy. Greedy quantifiers match as many occurrences of a particular pattern as possible. Appending the ? character to a quantifier makes it lazy, which will match as few occurrences as possible:

 


 

* 0 or more. Example: X* is X zero or more times
*? 0 or more (lazy)
+ 1 or more
+? 1 or more (lazy)
? 0 or 1
?? 0 or 1 (lazy)
{} Exact number. Example: {3} is exactly 3
{3,} 3 or more
{3,5} 3, 4 or 5
{3,5}? 3, 4 or 5 (lazy)