Replaces strings within the provided text that matches the pattern with replacement