Case insensitive re.sub()
Fredrik Lundh
fredrik at pythonware.com
Wed Feb 21 05:29:27 EST 2001
Timothy Grant 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?
add the flags to the pattern instead: "(?i)pattern" makes
"pattern" case-insensitive.
(note that there are issues with uppercase characters in case-
insensitive patterns in 2.0; to be on the safe side, only use
lowercase characters in case-insensitive patterns. or use 2.1)
Cheers /F
More information about the Python-list
mailing list