Making regex suck less

Bengt Richter bokr at oz.net
Wed Sep 4 15:15:42 EDT 2002


On Wed, 04 Sep 2002 07:14:08 GMT, "Fredrik Lundh" <fredrik at pythonware.com> wrote:

>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
>to stdout:
>
>>>> sre.compile("[a-z]\d*", sre.DEBUG)
>in
>  range (97, 122)
>max_repeat 0 65535
>  in
>    category category_digit
>
>turning this into 'English' is left as an exercise etc.
>
Interesting, thanks. Does the above mean that sre can't fully match
 'a'+'9'*65537
?

Regards,
Bengt Richter



More information about the Python-list mailing list