From: Robert Klemme Date: 2008-09-19T05:07:40+09:00 Subject: Re: short regexp question 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