New submission from Eugene Morozov <eugene.moro...@gmail.com>:

There's a peculiar and difficult to find bug in the re.sub method. Try 
following example:
>>> text = 'X'*4096
>>> nt = re.sub(u"XX", u".", text, re.U)
>>> nt
u'............XXXXXXXXXXXXXXXXXXX' (only 32 dots, the rest of the string is not 
changed).

If I first compile regexp, and then perform compiled_regexp.sub, everything 
seems to work correctly.

----------
components: Regular Expressions
messages: 128923
nosy: Eugene.Morozov
priority: normal
severity: normal
status: open
title: re.sub replaces only first 32 matches with re.U flag
type: security
versions: Python 2.6

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

Reply via email to