In Python 3, I\'d like to be able to use re.sub() in an \"accent-insensitive\" way, as we can do with the re.I flag for case-insensitive substituti
re.sub()
re.I
You can use Unidecode:
$ pip install unidecode
In your program:
from unidecode import unidecode original_text = "I'm drinking a café in a cafe." unidecoded_text = unidecode(original_text) regex = r'cafe' re.sub(regex, 'X', unidecoded_text)