((a+b)a)*
"you would say: words of even length where every even letter is an 'a'"
This is not a correct description. More accurate would be "words that have at least one a
, followed by exactly one b
, followed by exactly one a
, zero or more times"
(+
means "one or more", *
means "zero or more".)
It's more about the back and forth of a
s and b
s--there could be million a
s between the b
s, but there's never two b
s next to each other.
And note that the inner parenthesis are not needed. In other words, this is equivalent:
(a+ba)*
Free spaced:
(a+ //"a", one or more times
b //followed by exactly one "b"
a //followed by exactly one "a"
)* //zero or more times