All valid words that must have even number of a's or even number of b's [closed]
All valid words that must have even number of a's or even number of b's
I would recommend this site: http://rubular.com/. Its a sandbox for Regular Expressions where you can play around with them. It should help you solve your problem.
You cannot do this with one regular expression. For one word you'd need to do something like
if ((replace(/[^Aa]/g, "").length & 1) == 0)
Of course this highly depends on your programming language (the above would work in JavaScript)
精彩评论