You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2011-02-20.23:01:03.740>created_at=<Date2011-02-20.22:28:09.731>labels= ['type-security', 'expert-regex', 'invalid']
title='re.sub replaces only first 32 matches with re.U flag'updated_at=<Date2011-02-20.23:01:03.731>user='https://bugs.python.org/EugeneMorozov'
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.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: