Mega Code Archive

 
Categories / Php / Strings
 

Quantifiers for Matching a Recurring Character

Symbol         Description                                      Example   *              Zero or more instances                           a*   +              One or more instances                            a+   ?              Zero or one instance                             a?   {n}            n instances                                      a{3}   {n,}           At least n instances                             a{3,}   {,n}           Up to n instances                                a{,2}   {n1, n2}       At least n1 instances, no more than n2 instances a{1,2}