debugging python regexes

July 5th, 2010 § 0 comments § permalink

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

Where Am I?

You are currently browsing the tricks category at Dan O'Huiginn.