regex substitution example python Example: python regex substitute import re s = "Example String" replaced = re.sub('[ES]', 'a', s) print replaced