Match if several identical characters in a string
I would like to match if a string contains more than 1 identical character, for example : Using PHP preg_match or similar function.
the character would be "-"
Something-or other : no match
Test-tes-t : matchBasically what 开发者_高级运维I want to do is disallow the use of more than 1 "-" in a user input.
Isn't just substr_count($text, '-') > 1
enough?
精彩评论