[Melbourne-pm] Extracting a parenthesized fragment from a string

Sam Watkins sam at nipl.net
Fri Sep 11 05:36:29 PDT 2009


On Fri, Sep 11, 2009 at 07:05:45PM +1000, Robert Norris wrote:
> So, what's wrong here? And is there an easier way to do this? Note that
> I'm restricted to Perl 5.6, which sucks as I'd really like to try the
> PARNO stuff that came with 5.10.

I think normal regexps aren't the right tool for this, you can do it
easily in a couple of lines of C, but that method would be somewhat slow
in perl.  But given that you're dealing with IMAP, the network is going
to be a lot slower, so you might as well just do it with a for loop over
the characters and count parentheses, rather than some totally obscure
regexp hack.

Sam


More information about the Melbourne-pm mailing list