regex for balanced parentheses?

David C. Ullrich dullrich at
Thu Jun 12 19:44:10 CEST 2008

In article 
<206a91d7-8251-49f6-b500-e47af4887a10 at>,
 Paul McGuire <ptmcg at> wrote:

> Parsing TeX is definitely not for the faint-of-heart!  You might try
> something like QuotedString('$', escQuote='$$') in pyparsing.  (I've
> not poked at TeX or its ilk since the mid-80's so my TeXpertise is
> long rusted away.)

Thanks. Not actually parsing TeX, just going through and
making little changes to a few things. Easier since I wrote
the original crap so I know that various things don't come
up (for example _every_ % is the start of a comment and
_none_ of those comments is actually important, they're
all just old stuff commented out.)

> I know of two projects that have taken on the problem using pyparsing
> - one is the mathtext module in John Hunter's matplotlib, and Tim
> Arnold posted some questions on the subject a while back - try
> googling for "pyparsing tex" for further leads.
> -- Paul

David C. Ullrich

More information about the Python-list mailing list