How can I find strings with individual repeating characters (for example 3 times)?
This works but I don't want rewrite every alpha characters (a,b,c,d,e...):
开发者_高级运维... REGEXP '(a){3}|(b){3}|(c){3}|(d){3}|(e){3}|(f){3}...' ...
Thank you very much
r = '(\w)\1{2}`
finds any alphanumeric character that is repeated (at least) three times, matching the first three.
How about repeating a capture group?
r = '([abc])\1\1'
'(abc){3}'
Example:
> echo 'bbbabcabcabcaaabbbccc' | egrep -o '(abc){3}'
abcabcabc
精彩评论