Re[2]: [PHP] Counting number of characters without spaces between them?
| From: | Richard Davey | Date: | Fri, 23 Apr 2004 15:03:46 +0000 |
| Subject: | Re[2]: [PHP] Counting number of characters without spaces between them? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184398@lists.php.net to get a copy of this message | ||
Hello Tom,
Friday, April 23, 2004, 3:42:57 PM, you wrote:
TR> $string = "hello world!!!!!!!!!!!!!!!!! how arrrrrrrrrrrrrrre you today?????!!";
TR> if(preg_match_all('/(\w)\1{4,}|(\W)\2{4,}/',$string,$match)){
TR> echo "too many repeated characters<br>";
TR> print_r($match);
TR> }
TR> That will catch everything, except numbers, that is repeated 4 or more
TR> times.
Absolutely perfect - thank you!
--
Best regards,
Richard Davey
http://www.phpcommunity.org/wiki/296.html