Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要有关正则表达式的帮助。我想要一个正则表达式,其中字母 b 永远不会增加三倍。这意味着其中没有任何单词包含子字符串 bbb。语言只包含字母 {a,b}
这是阿迪娜艾哈迈德给出的答案中的问题。问题是,如果我们想写 bbabba,那么 Regex 就行不通了。
因此,根据条件,下面的正则表达式是完美的。
(a+ba+bba)*(bb+b+^)
其中 ^ 作为空词。
祝你好运。
(^+b+bb)(a+ab+abb)*
将 ^ 视为空词。