in reply to Re: parsing question

It's very difficult to do recursive substitutions with a regex alone, tilly says it's possible so i'll take his word for it. But modules like Text::Balanced and Parse::RecDescent are a godsend for this type of thing.

Replies are listed 'Best First'.
Re(2): Re: parsing question
by FoxtrotUniform (Prior) on Jan 08, 2002 at 21:46 UTC

    I think it's worth repeating what tilly and mstone have mentioned; that is, matching balanced delimiters cannot be done with a (formal) regular expression. Perl's "regexes", however, are more powerful than (formal) regular expressions, and (with some contortions) can match balanced delimiters.

    For the sake of whoever maintains your code, though, use Text::Balanced instead, and keep the gnarly regexes in reserve for when they're the best tool for the job.

    --
    :wq