go to previous page   go to home page   go to next page

Does [fr]*og match "frog" ?

Answer:

Yes. As well as "fog", "rog", "rfrog, "og", "fffrog", . . .


Star Automaton

three state finite automaton

A Kleene star in a regular expression corresponds to a loop in an automaton. The above automaton corresponds to [fr]*og.

Note that either character 'f' or character 'r' can be picked each time the transition is taken from state q0 back to state q0.


QUESTION 17:

Write a RE that matches strings of one or more zeros and ones, in any order.