On Fri, Oct 1, 2010 at 7:20 PM, Frank Guerino
<frank.guerino / traverseit.com> wrote:

> Given a string that contains one or more substrings within parenthesis,
> such as:
>
> myString = 'This is (variable length substring #1) (variable length
> substring #2) string'
>
> How would I effectively strip out anything between any two parenthesis
> and replace it with a blank (eliminating such substrings) such that it
> would look like:
>
> myString = 'This is a string'

>> myString
=> "This is (variable length substring #1) (variable length\nsubstring
#2) string"
>> myString.gsub(/\([^)]+\)\s+/,'')
=> "This is string"

Interpolating an "a" in there is another story :-)

HTH,
-- 
Hassan Schroeder ------------------------ hassan.schroeder / gmail.com
twitter: @hassan