How to determine {min, max} matches at the top of the top
2 answers
http://treetop.rubyforge.org/syntactic_recognition.html
A generalized number of repetitions (minimum, maximum) is also available.
'foo' 2 .. matches 'foo' two or more times
'foo' 3..5 matches 'foo' three to five times
'foo' .. 4 matches 'foo' zero to four times
+1
source to share