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

What is wrong with this RE: cat | dog | rat

Answer:

The spaces around the words are possibly not intended. It is tempting to use spaces to make the RE easier to read, but if they are in the RE, the spaces must be matched by spaces in the string.


Another Example

REs and their corresponding automata can get complicated. Here is an automaton that corresponds to the RE [abc]+[123]*|[def]*[456]+

complex automaton

 


QUESTION 6:

Which of the following strings is accepted by the automaton?

Stringa145ab23cd3644eeaaaabcd
Match or
Reject?