Making regex suck less
fredrik at pythonware.com
Wed Sep 4 03:14:08 EDT 2002
Bengt Richter wrote:
> I agree about new syntax, but I wouldn't mind having a re.help(regexp) function
> for interactive use that would just explain in 'English' what the regexp expression
> stands for.
you can ask SRE to dump the internal parse tree
>>> sre.compile("[a-z]\d*", sre.DEBUG)
range (97, 122)
max_repeat 0 65535
turning this into 'English' is left as an exercise etc.
More information about the Python-list