What is the difference between $(a|b)^\ast$ and $a^\ast b^\ast$? Can you show more examples of Kleene star and patterns and explain a little bit? I've searched so many sites in Google, but it returns very little results on this topic. I would be very grateful.
Tell me more
×
Mathematics Stack Exchange is a question and answer site for
people studying math at any level and professionals in related fields. It's 100% free, no registration required.
|
|
Assuming that $|$ refers to an "or" selection (so the character can be either an $a$ or a $b$, then $(a|b)^*$ is all strings composed of the characters $a$ and/or $b$, including the empty string. On the other hand, $a^*b^*$ refers to all strings composed of the characters $a$ and/or $b$ which has all $a$'s preceding all $b$'s, again including the empty string. For instance, $ababbbabab$ would be a member of $(a|b)^*$ but not $a^*b^*$, whereas $aaabbbbb$ would be a member of both. |
|||||||||
|
