If i want to take
"hi, my name is foo bar"
and divide it into "foo", and share it to register a case-insensitive (to split on any of the "foo", "foo", "foo", and so on), what do I do? Keep in mind that although I would like split to be case insensitive, I also want to keep case insensitive of the rest of the string.
So, if I have:
test = "hi, my name is foo bar"
print test.split('foo')
print test.upper().split("FOO")
I would get
['hi, my name is ', ' bar']
['HI, MY NAME IS ', ' BAR']
respectively.
But what I want :
['hi, my name is ', ' bar']
everytime. The goal is to maintain case sensitivity of the original string, except that I am sharing.
So, if my test line is:
"hI MY NAME iS FoO bar"
my desired result:
['hI MY NAME iS ', ' bar']
source
share