title: Regrex count mismatch (even number 'a' and 'b' in a string)
body: <p>I faced a problem that I hope to construct a regrex to distinguish a string with even numbers of 'a' and even numbers of 'b':</p>
  <p>A plausible solution would be like this:
  (aa|bb)*((ab|ba)(aa|bb)*(ab|ba)(aa|bb)*)*
  But after checking, a simple string 'a' can also pass this check, but I do not know why...</p>
  <p>Moreover, based on the previous condition, I have to also allow 'c' to exist (0 to many) times at any positions. That is, the string should contain even numbers of 'a' and even numbers of 'b' and (0 to many) numbers of 'c'. Only these three characters are allowed.</p>
  <p>How may I solve this using only regrex expression?</p>
  <p>Thanks a lot for help!</p>