case insensitive replace python

Solutions on MaxInterview for case insensitive replace python by the best coders in the world

showing results for - "case insensitive replace python"
Sabri
22 Apr 2020
1>>> import re
2>>> insensitive_hippo = re.compile(re.escape('hippo'), re.IGNORECASE)
3>>> insensitive_hippo.sub('giraffe', 'I want a hIPpo for my birthday')
4'I want a giraffe for my birthday'