New submission from Tom Dawes <tomdawe...@gmail.com>:

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.

----------
components: Regular Expressions
messages: 326911
nosy: ezio.melotti, mrabarnett, tdawes
priority: normal
severity: normal
status: open
title: re.finditer behaviour in re.MULTILINE mode fails to match first 7 
characters
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34873>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to