Objectives:
| For each regular expression, enter it in JFLAP (be sure not to
include spaces in the regular expression), convert to an
NFA, use multiple run tester to list five input strings in the
language (if there exists at least five). Finally try to clearly explain the regular language
that it represents: i) a*b* + c ii) (ab+l)b -- Hint: l is represented by ! in JFLAP iii) (cd+b)* |
| Write a regular expression for each of the following languages
and test it for correctness in JFLAP. i) The language with an even number of a's followed by an odd number of b's ii) The language with zero or more a's followed by three or fewer b's iii) The language in which every a must have a b adjacent to it on both sides. |
The format of a regular expression in egrep is as follows:
|
expression |
egrep notation |
|
r* |
r* |
|
r+ |
r+ |
|
r +l |
r? |
|
r+s |
r|s |
|
rs |
rs |
|
( r ) |
( r ) |
|
char c |
c |
|
special char |
\c |
|
any symbol |
. |
|
beginning-of-line |
^ |
|
end-of-line |
$ |
|
any character listed |
[…] |
|
any character not listed |
[^…] |
Login to phoenix and try the following:
egrep depend /usr/share/dict/words
egrep
‘^y.*y$’ /usr/share/dict/words
egrep ‘y.*y’ /usr/share/dict/words
egrep ^rec(ei|ie)ve$’
/usr/share/dict/words
egrep ^s..u.t..e$’ /usr/share/dict/words
egrep (^| )the +the( |$) ~jillz/cs250/lab3/testfile1
egrep '[qQ][^u]'
/usr/share/dict/words
| Clearly and succinctly describe the pattern that is being
expressed by each of the regular expressions above. |
Write egrep commands for the following:
Test your commands on ~jillz/cs250/lab3/testfile1 and any test
file of your own. |
| Correct the regex above so that it does not match illegal times
like 99:99pm
|
| Modify the regular expression in convert so that the temperatures may be decimal values and the C and F may be either lower or upper case. Also allow there to be possible whitespace between the number and the C or F. |
| Modify mkreply so the the $subject does not contain any
preceding Re: For example, "Re: Re: Re: This is the subject" would only store "This is the subject". |