Hi, Saturday, April 24, 2004, 12:42:57 AM, you wrote: TR> Hi,
TR> Friday, April 23, 2004, 11:50:56 PM, you wrote: TR> You could try something like this 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. With preg_split() you can do a bit of correction too: $string = "hello world!!!!!!!!!!!!!!!!! how arrrrrrrrrrrrrrre you today?????!!"; if(preg_match_all('/(\w)\1{4,}|(\W)\2{4,}/',$string,$match)){ echo "too many repeated characters<br>"; print_r($match); } $split = preg_split('/(\w)\1{4,}|(\W)\2{4,}/',$string); print_r($split); $out = ''; foreach($split as $key=>$val){ $out .= $val; if(!empty($match[1][$key])) $out .= $match[1][$key]; elseif(!empty($match[2][$key])) $out .= $match[2][$key]; } echo $out.'<br>'; The tricks you learn with this PHP :-) -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php