开发者

Constructing Strings using Regular Expressions

Assuming you have a a set E = {a,b}, and you have a superset E* consisting of all possible combinat开发者_如何学编程ions of a, and b in E. How do you construct an expression for a String that has number of a's divisible by 3?


Try

/^(b*ab*ab*ab*)+$/

Examples:

abbb => N
bbb => N
aaab => Y
ababbbba => Y
aaabba => N
bbbaaaabbbabbbba => Y
 => N
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜