a
surrounded by any number of bs in front of it and any number of
cs after it. (bac bbbac baccc bbbbaccccc
but not baab abbb bbba ccab bcabc)
1024 2A0FF but not 80G0 X9123 text)
1.298 1.6 .5 123.4 23. 1e-5 5.67E2 71E-5
5.67e27 .54 23 but not 1.2.3 E5) Try to make
your expression as general as possible; it should match any valid floating
point literal. A leading minus sign is not part of the number.
(You will be writing a function to do this in an upcoming
programming assignment.)
For more information about regular expressions, see the notes from class and the links given in the class web pages as well as the following books which are available at the Albertson's library.
On onyx, you can test a regular expression that uses perl syntax by copying the file testPattern (a perl script in the ~tcole/teaching/cs354/handouts) into your directory, making sure it is executable and typing the pattern onto the command line when you run the script
./testPattern pattern
Note: There is a fair amount of overlap between regular-expression metacharacters and characters that mean something special to the shell. You can use an escape character (\) in front of these or you can put single quotes around the pattern to keep the shell from complaining.
a preceeded by
any number of bs and followed by the same number of
cs. (bac bbacc bbbaccc bbbbacccc
but not bacc acc bbba ccab bcabc)
Can you write a regular expression that matches the expressions generated by this grammar?
This assignment can be turned in
submit tcole cs354 h3
Acceptable formats for electronically submitted assignments are text, OpenOffice or MicrosoftWord. I should be able to open your assignment with OpenOffice. Unless otherwise specified in the assignment, the entire assignment should be in a single document.