开发者

Regular expression: same character 3 times

I want a regular expression (in php) to this (same character 3 times):

aa => false
aaa 开发者_JS百科=> true
baaa => true
aaab => true
aaaaaab => true
baaab => true
babababa => false

For any character, not only 'a' and 'b'.


You can use back-references within a regex

/(.)\1\1/


Try this regular expression:

(.)\1{2}


This will do the job :

/(.)\1\1/
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜