From: Fritzek Date: 2008-09-19T00:02:25+09:00 Subject: Re: short regexp question 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" wrote: > Hi -- > > > > On Thu, 18 Sep 2008, Fritzek wrote: > > Hi folks > > > short question how to use regexp the right way > > given is a="a[b]c" > > I nedd b="a c" > > > tried to split using (/(\[|\])/) to get  ["a", "[", "b", "]", "c"] > > > b=a.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 = a.delete("[b]") > > David > > -- > Rails training from David A. Black and Ruby Power and Light: >    Intro to Ruby on Rails  January 12-15   Fort Lauderdale, FL >    Advancing with Rails    January 19-22   Fort Lauderdale, FL * >    * Co-taught with Patrick Ewing! > Seehttp://www.rubypal.comfor details and updates!