preparser state for regexs
I would have expected the following to work:
reset()
import re
preparser(False) # preparser off else we have \\ instead of \
rx=re.compile(r".*(\sHun\s).*") # in the regex
m = rx.match(r"The Attila the Hun Show") # Find "Hun" in "The Attila the Hun Show"
if m: print "found =>", m.group(1) # 1 needs to be 1 not '1' here!
preparser(True)
In fact I get 'IndexError: no such group'. Using int(1) fixes the problem, but why? The preparser is off!
Even more curious the block works, as is, on every other evaluate! I tried moving the preparser(False) statement to before the import, but that makes no difference.