Construct a regular expression that matches:
(a) At least one
a
followed by any number of
b
's
(b) Any number of backslashes followed by any number of asterisks (any number might be zero)
(c) Three consecutive copies of whatever is contained in
$whatever
(d) Any five characters,
including
newline
(e) The same word written two or more times in a row (with possibly varying intervening whitespace), where "word" is defined as a nonempty sequence of nonwhitespace characters
(a) Write a program that accepts a list of words on
STDIN
and looks for a line containing all five vowels (
a
,
e
,
i
,
o
, and
u
). Run this program on some large text file and see what shows up. In other words, enter:
>
perl myprogram.plx < mytextfile
(This presumes you name your program
myprogram.plx
.)
(b) Modify the program so that the five vowels have to be in order, and intervening letters don't matter.
(c) Modify the program so that all vowels must be in an increasing order; all five vowels have to be present; and no "e" can occur before an "a", no "i" can occur befor an "e", and so on.