Regular Expression IGNORECASE different for findall and split?

Chris c at cdot.de
Tue Sep 6 15:52:53 EDT 2005


hello,
I have question about the re.I option for Regular Expressions:

 >>> import re
 >>> re.findall('x', '1x2X3', re.I)
['x', 'X']

as expected finds both lower and uppercase x


 >>> re.split('x', '1x2X3', re.I)
['1', '2X3']
 >>> re.split('x', '1x2X3')
['1', '2X3']

I expected ['1', '2', '3'] but in this case re.I bahaves exactly as not 
present at all...

Is that an expected behaviour or a fault?
Running Python 2.4.1 on Windows XP

thanks for any hint
chris




More information about the Python-list mailing list