regular expressions $(a+b)^*$

384 Views Asked by At

If I have a regular expression $(a+b)^*$, does that mean I can't have the string $abba$ because the expression ends with a $b$? Or does this expression accept every string in the alphabet $\{a, b\}$?

2

There are 2 best solutions below

5
On

(a+b)* = (b+a)* because "or" is commutative.

0
On

This regular expression means that at every position in the string you may have either an $a$ or a $b$. That describes every possible string over the alphabet $\{a,b\}$.