I have the following problem:

Python 2.7 (r27:82525, Jul  4 2010, 07:43:08) [MSC v.1500 64 bit
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> t="Python26"
>>> import re
>>> re.sub(r"python\d\d", "Python27", t)
'Python26'
>>> re.sub(r"python\d\d", "Python27", t, re.IGNORECASE)
'Python26'
>>> re.sub(r"Python\d\d", "Python27", t, re.IGNORECASE)
'Python27'
>>>

---

Perhaps this is intended behavior, but it seems like the last two
results should be the same, not the first two.  In other words, the
call to re.sub with re.IGNORECASE on should return "Python27" not
"Python26".

This appears to be the case when using compiled pattern matching:

>>> r=re.compile(r"python\d\d", re.IGNORECASE)
>>> r.sub("Python27", t)
'Python27'

---

Is this a known bug?  Is it by design for some odd reason?
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to