regex - Php Regular Expression repeated characters -


I have a string in php like this in such a way.

$ str = "ABCCCDE" // is repeated in

I want to know that there are more than twice repeated characters using regular expressions.

Thanks in advance

postprice = "text">

  if (preg_match ('/ (.) \\ 1 {2} / ', $ str) is echo "3 identical characters continuously!";  

(.) will match any character (except for new lines), and \ 1 equally evenly Matched groups will match up - in this case, the character we just matched. So it will match RegEx 3 consecutive letters.


Comments