[New-bugs-announce] [issue26354] re.I does not work as expected

Magesh Kumar report at bugs.python.org
Fri Feb 12 19:19:24 EST 2016


New submission from Magesh Kumar:

I am in the process of re.sub the tag <item type="dict"> </item> with empty string from a xml output line.

If "re.I" is used, I am not able to remove the complete tag. 

========================================================================
>>> a
'ype="str">false</latency_statistics_enabled><name type="str">Default</name><aggregates type="list"><item type="dict"><aggregate type="list"><item type="dict"><type type="str">MulticastClient</item><is'

>>> b = re.sub('\<\/?item(\s+type="dict")?\>', '', a, re.I)
>>> b
'ype="str">false</latency_statistics_enabled><name type="str">Default</name><aggregates type="list"><aggregate type="list"><type type="str">MulticastClient</item><is'
>>> b = re.sub('\<\/?item(\s+type="dict")?\>', '', a)
>>> b
'ype="str">false</latency_statistics_enabled><name type="str">Default</name><aggregates type="list"><aggregate type="list"><type type="str">MulticastClient<is'

========================================================================

----------
components: Regular Expressions
messages: 260216
nosy: Magesh Kumar, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: re.I does not work as expected
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26354>
_______________________________________


More information about the New-bugs-announce mailing list