New submission from Jan Švec <honza.s...@gmail.com>:

re.sub() is behaving incorrectly, if re.IGNORECASE is used. Tested on 2.7, 3.4 
and 3.6. The code follows:

import re

def subst(text):
   text = re.sub(r"\bnine\b", "niner", text, re.IGNORECASE)
   return text

print(subst("nine nine nine nine"))

It prints "niner niner nine nine". Without the re.IGNORECASE, the output is 
correct: "niner niner niner niner"

----------
components: Regular Expressions
messages: 321062
nosy: Jan Švec, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: Bad behavior of re.IGNORECASE
type: behavior
versions: Python 2.7, Python 3.4, Python 3.6

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

Reply via email to