[issue10328] re.sub[n] doesn't seem to handle /Z replacements correctly in all cases

2019-04-27 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> out of date stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Py

[issue10328] re.sub[n] doesn't seem to handle /Z replacements correctly in all cases

2019-04-27 Thread Mark Lawrence
Change by Mark Lawrence : -- nosy: -BreamoreBoy ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue10328] re.sub[n] doesn't seem to handle /Z replacements correctly in all cases

2019-04-27 Thread Ma Lin
Ma Lin added the comment: This bug was fixed in Python 3.7, see issue32308. Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 23 2018, 23:31:17) [MSC v.1916 32 bit (Intel)] on win32 >>> re.compile('(?m)(?P[ >>> \t]+\r*$)|(?P(?<=[^\n])\Z)').subn(lambda m:next('<'+k+'>' >>> for k,v in m.groupdict().i

[issue10328] re.sub[n] doesn't seem to handle /Z replacements correctly in all cases

2014-09-30 Thread Mark Lawrence
Mark Lawrence added the comment: @Serhiy can you take a look at this as I recall you've been doing some regex work? -- nosy: +BreamoreBoy, serhiy.storchaka versions: +Python 3.4, Python 3.5 -Python 3.1 ___ Python tracker

[issue10328] re.sub[n] doesn't seem to handle /Z replacements correctly in all cases

2010-11-05 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- versions: +Python 2.7 -Python 2.6 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue10328] re.sub[n] doesn't seem to handle /Z replacements correctly in all cases

2010-11-05 Thread Matthew Barnett
Matthew Barnett added the comment: It's a bug caused by trying to avoid getting stuck when a zero-width match is found. Basically the fix is to advance one character after a zero-width match, but that doesn't always give the correct result. There are a number of related issues like issue #164

[issue10328] re.sub[n] doesn't seem to handle /Z replacements correctly in all cases

2010-11-05 Thread R. David Murray
Changes by R. David Murray : -- nosy: +mrabarnett ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.p

[issue10328] re.sub[n] doesn't seem to handle /Z replacements correctly in all cases

2010-11-05 Thread Alexander Schmolck
New submission from Alexander Schmolck : In certain cases a zero-width /Z match that should be replaced isn't. An example might help: re.compile('(?m)(?P[ \t]+\r*$)|(?P(?<=[^\n])\Z)').subn(lambda m:next('<'+k+'>' for k,v in m.groupdict().items() if v is not None), 'foobar ') this gives ('