Example. Examples of regular expression matching [017E]

Consider regular expression matching over the alphabet \Sigma ={\mathopen {}\left \{a,b\right \}\mathclose {}}.

  1. a\vert b is matched by each symbol in \Sigma .
  2. (a\vert b)* is matched every string over \Sigma .
  3. b(a\vert b)* is matched by any string over \Sigma that starts with a b.
  4. ((a\vert b)(a\vert b))* is matched by any string of even length over \Sigma .
  5. (\underline {\epsilon }\vert a)(\underline {\epsilon }\vert b)\vert bb is matched just by the strings \epsilon , a, b, ab, and bb.
  6. \varnothing b\vert a is matched only by the symbol a.