Replace all occurrences of a pattern in a text by another string