adding re.IGNORECASE to my regex causes some matches to fail. This is what I was trying:
print re.sub(r'[^a-z0-9 ]', '~', 'this (is) some tandom. text+ and [some] symbols {+/\-}', re.IGNORECASE) >>>'this ~is~ some tandom. text+ and [some] symbols {+/\\-}' we can see that many symbols were not replaced with '~' in the above, but when I try the same without re.IGNORECASE all the special characters are replaced with '~'
print re.sub(r'[^a-zA-Z0-9 ]', '~', 'this (is) some tandom. text+ and [some] symbols {+/\-}') >>> 'this ~is~ some tandom~ text~ and ~some~ symbols ~~~~~~' is there something I am missing about re.IGNORECASE? doesnt it just match both uppercase and lowercase alphabets while leaving the rest (digits, special chars, etc) unchanged? (I am using Anaconda's python 2.7 if that might be of any help)