Theory of Computing
THE HYPERTEXTBOOK
Chapter 2. Finite State Automata, Regular Languages, Regular Expressions, and Regular Grammars
Section 4. Regular Expressions

Exercise

Use the following applet to complete the exercise listed in the right applet pane.  Check the notes below the applet for help in using it

 

Your browser is ignoring the <APPLET> tag!

 

How to Use

  • You can only use the operators concatenation, |, and *, along with parentheses, in constructing regular expressions.
  • Do your work in the Regular Expression tab if you want to type the regular expression without using any auxilliary expressions (e.g., <digit> to stand for (0|1|2|3|4|5|6|7|8|9) ).
  • Do your work in the Auxilliary Expressions tab if you want to type the regular expression without using any auxilliary expressions (e.g., <digit> to stand for (0|1|2|3|4|5|6|7|8|9) ).
  • When you use the Auxilliary Expressions tab, enter any (or no) auxilliary regular expression definitions, and then enter the final regular expression for the problem in the bottom "final regular expression" slot using any of the auxilliary regular expressions you defined earlier.
  • If you do use the Auxilliary Expressions tab to incorporate auxilliary expressions (e.g., <digit> to stand for (0|1|2|3|4|5|6|7|8|9) ), enter the regular expression name without the brackets (e.g., digit rather than <digit>) on the left hand side of the regular expression. Type the regular expression on the right hand side making certain to use left and right parentheses, as in

                          digit = (0|1|2|3|4|5|6|7|8|9), not

                          digit = 0|1|2|3|4|5|6|7|8|9, or

                          <digit> = (0|1|2|3|4|5|6|7|8|9)

  • When you enter the final regular expression using auxilliary expressions, use the angle brackets with auxilliary expression names, as in

                            <digit><digit>*