Replace text in a stream