Hi David

thanks for quick answer. your code just works, if you know "b". I only
know the surrounding brackets "[" and "]" The bit in between could be
everything. sorry, forgot to mention.

Fritzek

On 18 Sep., 16:54, "David A. Black" <dbl... / rubypal.com> wrote:
> Hi --
>
>
>
> On Thu, 18 Sep 2008, Fritzek wrote:
> > Hi folks
>
> > short question how to use regexp the right way
> > given is a=3D"a[b]c"
> > I nedd b=3D"a c"
>
> > tried to split using (/(\[|\])/) to get =A0["a", "[", "b", "]", "c"]
>
> > b=3Da.strip.split(/(\[|\])/)
>
> > and then joined the bits together. this just works in a simple case
> > like "a[b]c", but "[b]" could occur multiple times.
>
> > I need something like search for any "[b]" and substitute with a
> > blank.
>
> b =3D a.delete("[b]")
>
> David
>
> --
> Rails training from David A. Black and Ruby Power and Light:
> =A0 =A0Intro to Ruby on Rails =A0January 12-15 =A0 Fort Lauderdale, FL
> =A0 =A0Advancing with Rails =A0 =A0January 19-22 =A0 Fort Lauderdale, FL =
*
> =A0 =A0* Co-taught with Patrick Ewing!
> Seehttp://www.rubypal.comfor details and updates!