Replace the first occurrence of the pattern
In-place pattern replacement