Answer the question
In order to leave comments, you need to log in
How to replace more than two repeated characters in a row using regular expressions?
For example, there is a number "12225422642". It is necessary that only the first three deuces be replaced by one deuce.
Answer the question
In order to leave comments, you need to log in
if for some reason you don't want to learn regular expressions, then what prevents you from using the while loop (strpos($str, '222') !== false) ?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question