Issue 34873: re.finditer behaviour in re.MULTILINE mode fails to match first 7 characters (original) (raw)
re.finditer appears to fail to match within the first 7 characters in a string when re.MULTILINE is used:
REGEX = re.compile("y") [list(m.start() for m in REGEX.finditer("{}y".format("x"*i), re.MULTILINE)) for i in range(10)] [[], [], [], [], [], [], [], [], [8], [9]]
Without re.MULTILINE, this works fine:
[list(m.start() for m in REGEX.finditer("{}y".format("x"*i))) for i in range(10)] [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
Passing re.MULTILINE to re.compile doesn't seem to have any effect.