If I want to take
\"hi, my name is foo bar\"
and split it on \"foo\", and have that split be case insensitive (split on any of
\"foo\"
You can use the re.split function with the re.IGNORECASE flag (or re.I for short):
re.I
>>> import re >>> test = "hI MY NAME iS FoO bar" >>> re.split("foo", test, flags=re.IGNORECASE) ['hI MY NAME iS ', ' bar'] >>>