Frage

Assuming you have a a set E = {a,b}, and you have a superset E* consisting of all possible combinations of a, and b in E. How do you construct an expression for a String that has number of a's divisible by 3?

War es hilfreich?

Lösung

Try

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

Examples:

abbb => N
bbb => N
aaab => Y
ababbbba => Y
aaabba => N
bbbaaaabbbabbbba => Y
 => N
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top