Case insensitive re.sub()
Aahz Maruch
aahz at panix.com
Tue Feb 20 19:13:44 EST 2001
In article <mailman.982712484.28722.python-list at python.org>,
Timothy Grant <tjg at exceptionalminds.com> wrote:
>
>I am working on a little project where it would be really nice
>to be able to do a case insensitive re.sub(). It appears that
>re.sub() does not allow a flags argument. Is it possible, or do
>I have to roll my own?
import re
regex = re.compile('foo', re.I)
print regex.sub('bar','FOOBAR')
--
--- Aahz (Copyright 2001 by aahz at pobox.com)
Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
The problem with an ever-changing .sig is that you have to keep changing it
More information about the Python-list
mailing list