Utility to locate errors in regular expressions

Devin Jeanpierre jeanpierreda at gmail.com
Fri May 24 09:13:41 EDT 2013


On Fri, May 24, 2013 at 8:58 AM, Malte Forkel <malte.forkel at berlin.de> wrote:
> As a first step, I am looking for a parser for Python regular
> expressions, or a Python regex grammar to create a parser from.

the sre_parse module is undocumented, but very usable.

> But may be my idea is flawed? Or a similar (or better) tools already
> exists? Any advice will be highly appreciated!

I think your task is made problematic by the possibility that no
single part of the regexp causes a match failure. What causes failure
depends on what branches are chosen with the |, *, +, ?, etc.
operators -- it might be a different character/subexpression for each
branch. And then there's exponentially many possible branches.

-- Devin



More information about the Python-list mailing list