用于在字符串中查找超过4个连续重复字符的正则表达式

2024-10-04 09:23:36 发布

您现在位置:Python中文网/ 问答频道 /正文

我想找出一个字符串中超过4个连续的重复字符。e、 g.(string is lowercased)

bbaaaaa ---> yes (5 consecutive a's)
bbaa   ---> no
aabbbbbccdddddee ---> yes (5 consecutive b's)

一种可能的解决方案是将a循环到z并使用character{4,},其中{}可以是a到{}之间的任何人。在

有没有一个班轮?在

如果是重复的,我很抱歉


Tags: no字符串stringis解决方案字符yescharacter