Mega Code Archive

 
Categories / Php / Strings
 

Quantifiers

p+ matches any string containing at least one p. p* matches any string containing zero or more p's. p? matches any string containing zero or more p's. This is just an alternative way to use p*. p{2} matches any string containing a sequence of two p's. p{2,3} matches any string containing a sequence of two or three p's. p{2, } matches any string containing a sequence of at least two p's. p$ matches any string with p at the end of it. ^p matches any string with p at the beginning of it. [^a?zA?Z] matches any string not containing any of the characters ranging from a through z and A through Z. p.p matches any string containing p, followed by any character, in turn followed by another p.