[issue11947] re.IGNORECASE does not match literal "_" (underscore)

2014-10-29 Thread STINNER Victor
Changes by STINNER Victor : -- resolution: not a bug -> duplicate superseder: -> re.sub confusion between count and flags args ___ Python tracker ___ ___

[issue11947] re.IGNORECASE does not match literal "_" (underscore)

2011-04-29 Thread Ezio Melotti
Ezio Melotti added the comment: See also #11957. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mai

[issue11947] re.IGNORECASE does not match literal "_" (underscore)

2011-04-29 Thread Robert Meerman
Robert Meerman added the comment: Oh, that's embarrassing. :-) Could a type-check be used to alert the user to their mistake? I suppose that would require re.IGNORECASE (et al) to be of some new type (presumably sub-classed from Integer). (Thanks for the quick response, and sorry to waste yo

[issue11947] re.IGNORECASE does not match literal "_" (underscore)

2011-04-28 Thread Matthew Barnett
Matthew Barnett added the comment: I don't know how much code that might break. It might not be that much; I can't remember when I last used re.sub without the default count. -- ___ Python tracker ___

[issue11947] re.IGNORECASE does not match literal "_" (underscore)

2011-04-28 Thread Ezio Melotti
Ezio Melotti added the comment: Closing as invalid. I wonder if it would be better to have count as a keyword-only argument though, since this problem seems to come up pretty often and it's not easy to debug. -- resolution: -> invalid stage: -> committed/rejected status: open -> clos

[issue11947] re.IGNORECASE does not match literal "_" (underscore)

2011-04-28 Thread Matthew Barnett
Matthew Barnett added the comment: help(re.sub) says: sub(pattern, repl, string, count=0) and re.IGNORECASE has a value of 2. Therefore this: re.sub("_", "X", subject, re.IGNORECASE) is telling it to replace at most 2 occurrences of "_". -- nosy: +mrabarnett __

[issue11947] re.IGNORECASE does not match literal "_" (underscore)

2011-04-28 Thread Robert Meerman
New submission from Robert Meerman : Regular expressions which are written match literal underscores ("_", ASCII ordinal 95) and specify `re.IGNORECASE` during compilation do not consistently match underscores: it seems some occurrences are matched, but others are not. The following session lo