Is there something like the Perl Text::Balanced module for Ruby? That is, something that can take this:
(( some text (with a parenthetical comment)))
and extract out this:
some text (with a parenthetical comment)
I know in Perl, for some cases, you can make this work just using a "regular expression" (quoting that because I realize now that a pure RE can't handle this case -- Perl does it via extended operators and this is a known NP sort of problem for the general case). I don't believe Ruby supports these same sort of extensions?
The only mention I see of this at all (thank you Google) is this:
...but that's from 2003, so I'd think someone might have tried to figure out a way to do this by now.
I'm just trying to avoid writing my own parser for this case if I can leverage good code someone else has thought of. Any ideas?