Mega Code Archive

 
Categories / Ruby / Development
 

Repetition

r*      matches zero or more occurrences of r.  r+      matches one or more occurrences of r.  r?      matches zero or one occurrence of r.  r{m,n}  matchesatleast "m"and at most "n"occurrencesof r.  r{m,}   matchesatleast "m"occurrencesof r.  r{m}    matches exactly "m" occurrences of r.  /ab+/ matches an a followed by one or more b's, not a sequence of ab's. /a*/  will match any string; every stringhas zero or more a's.