开发者

Constructing Strings using Regular Expressions

开发者 https://www.devze.com 2023-04-06 20:23 出处:网络
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 numb

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

精彩评论

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