From: Fritzek Date: 2008-09-19T22:07:15+09:00 Subject: Re: short regexp question Hi Robert thanks for your objection, but could you shortly explain the difference (for regexp dummies like me)? Fritzek On 18 Sep., 22:13, Robert Klemme wrote: > On 18.09.2008 17:47, Fritzek wrote: > > > Hi Sebastian > > > thanks for the solution. works perfect. > > > Fritzek > > > On 18 Sep., 17:31, Sebastian Hungerecker > > wrote: > >> Fritzek wrote: > >>> short question how to use regexp the right way > >>> given is a="a[b]c" > >>> I nedd b="a c" > >> "a[b]c".gsub(/\[.*?\]/, " ") > > Not sure whether it makes a difference performance wise but I am always > reluctant to use reluctant quantifiers.  I'd rather do > > irb(main):003:0> "a[b]c".gsub /\[[^\]]*\]/, ' ' > => "a c" > > Kind regards > >         robert