in reply to Regex To remove text between parentheses

This works fairly well. It can also get rid of nested parentheses like this: (begin(next(third))). Though not like (begin(next)third).
s/\([^)]+\)+//g;

Replies are listed 'Best First'.
(tye)Re: Regex To remove text between parentheses
by tye (Sage) on Jul 10, 2001 at 22:46 UTC

    No, it doesn't handle even your first case of nesting correctly. My preference is to use: s#\([^()]*\)##g and repeat if you need to worry about nested parens: 0 while s#\([^()]*\)##g; I really hate complicated regexes.

            - tye (but my friends call me "Tye")