debugging python regexes

Neat trick from stackoverflow: the

re.DEBUG

flag for python regexes:


> re.compile('a(b+)a', re.DEBUG)
literal 97
subpattern 1
max_repeat 1 65535
literal 98
literal 97

Leave a comment

Your email address will not be published. Required fields are marked *