Reputation: 63
checking if a string has more than running one occurrence of same character.
like iiiiiiii
or ssssss
. maybe use preg_match but what pattern it should be?
Upvotes: 0
Views: 79
Reputation: 816
Try with this regex:
$str = 'hello';
print preg_match('/([\w])\1{1,}/', $str); /*return true */
Upvotes: 3