in reply to Re: Text elimination within a string
in thread Text elimination within a string

Though, if there is a chance that there would be parens in the later part of the string...

(BW)(CA-LIGAND-PHARMACEUTICALS)(LGND) Ligand's Targretin Capsules Approved in Europe, Targretin Gel European Application Submitted; Ligand to Receive $3.5 Million (¥433.3 Million) Milestone Payments From Elan

... that regex would take out most of the wanted text.

s/^(\(.*?\))*//;
That will only take of the leading text encased in parens.

- FrankG

Replies are listed 'Best First'.
Re: Re: Re: Text elimination within a string
by alfie (Pilgrim) on Apr 09, 2001 at 11:46 UTC
    Add a g as option to your s/// and might be right. Still you should consider using the following regex that doesn't use .*:
    s/\([^)]\)//g;
    Which will strip off all braced strings, including the braces.
    --
    Alfie
Re: Text elimination within a string
by cLive ;-) (Prior) on Apr 09, 2001 at 02:45 UTC
    um, this regex doesn't work - I think you meant .* at end, but even then it won't work because it would only match the first set of braces.

    cLive ;-)

    Update: - ah yes, with a g. I also "saw" a $1 that wasn't there. Otherwise, why (remember) it?