Source Code:
(back to article)
import re string = "The quick brown fox jumps over the lazy dog." # Replace all occurrences of the word that starts with "t" and ends with "e" with "a" new_string = re.sub(r"\b[tT]\w*e\b", "a", string) print(new_string)
Result:
Report an issue