From: Brian Candler Date: 2003-05-12T23:51:44+09:00 Subject: Re: Regexp: why does (re)* return only last repetition? On Mon, May 12, 2003 at 10:18:00PM +0900, Austin Ziegler wrote: > On Mon, 12 May 2003 17:39:19 +0900, Robert Klemme wrote: > > Clifford Heath: > >> Robert Klemme wrote: > >>> Clifford Heath: > >>>> re = Regexp.new('[a-z\\]') > >>> Why not simply do > >>> re = /[a-z\\]/ > >> Because it was part of a larger extended re. > > But you can still use re = /.../ instead of re = Regexp.new '...' > > Again, if and only if one is specifying the regular expression > statically. It doesn't have to be static: pat = "ana" str = "banana" index = /#{pat}/ =~ str p index # >>1 Regards, Brian.