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 <rep...@bugs.python.org>
<http://bugs.python.org/issue26354>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to