Regular expression: does Kleene star have a distributive property?

kleene-star, regex

Solution

Kleene star does not distribute. `(ab)*` is very different from `(a*b*)`.

In your specific example, `(aa)*` would match groups of two `a`s (thus, it only matches even numbers of `a`s), while `(a*a*)` is equivalent to `(a*)` and matches any sequence of `a`s. (In that case, `L((aa)*)` is a proper subset of `L((a*a*))`, but this is not necessarily true for a general regex).

Problem

Would there be a difference between `(aa)*` and `(a*a*)`? Is there a distributive property?

Original source