What is wrong with this RE: cat | dog | rat
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.
REs and their corresponding automata can get complicated.
Here is an automaton that corresponds to the RE
[abc]+[123]*|[def]*[456]+
Which of the following strings is accepted by the automaton?
String | a1 | 45 | ab23 | cd36 | 44ee | aaa | abcd |
---|---|---|---|---|---|---|---|
Match or Reject? |