in reply to Extracting a parenthesized fragment from a string

Maybe you could use Text::Balanced instead? (in particular extract_bracketed())

Module::CoreList says it's a core module since:

$ corelist Text::Balanced Text::Balanced was first released with perl 5.007003

(IOW, for 5.6 you'd have an additional dependency...)

Replies are listed 'Best First'.
Re^2: Extracting a parenthesized fragment from a string
by fce2 (Sexton) on Sep 11, 2009 at 12:49 UTC

    I'd forgotten about this module, but yes, it could probably do quite well. I'll try a couple of implementations based on the different ideas that have been presented here and see how they compare for readability, speed, and so forth. Cheers!