"Gennady" <gfb / tonesoft.com> wrote:

> From: "Ronald Pijnacker" <rhp / dse.nl>
> 
> > There is certainly a lot of information there, but I have the feeling
> > that there are things not discussed. My example "r {m}" is not mentioned
> > as such, but works anyway.
> 
> It IS mentioned there, as well as answeres to ALL of your other questions
> (see also http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html ,
> scroll down to "Regular Expression Options" and "Regular Expression
> Patterns").
> 
> Here's a cut-and-paste subsection of "Regular Expressions" section at
> http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_stdtypes.html
> 
> <quote>
> 
>       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}  matches at least ``m'' and at most ``n'' occurrences of r.
>       r {m,}  matches at least ``m'' occurrences of r.
> 
> </quote>

To be fair to Ronald, his specific example is not there:

        r {m}  matches exactly ``m'' occurrences of r.

puts $& if 'abcdef' =~ /.{3}/
puts $& if 'abcdef' =~ /.{3,}/
puts $& if 'abcdef' =~ /.{3,4}/

__END__
abc
abcdef
abcd