Fritzek
9/19/2008 1:14:00 PM
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 <shortcut...@googlemail.com> 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 <sep...@googlemail.com>
> > 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