Exploring Regular Expressions
You are to learn PHP and how to use the regular expression
mechanism in PHP. Do a few warm-ups in using regular expressions,
and then search for various patterns in words in the
dictionary.
- Learn PHP. This sounds like a big first step. Actually,
install PHP and try to write small PHP script that
prints "Hello World". You are on your way!
- Now learn just a few additional facts about PHP: how to
do if statements and loops; learn a bit more about variables,
and particularly strings; learn a bit about files and input/output.
This should be enough about PHP for this assignment.
- Learn about PHP regular expression mechanism. Write
a few scripts that match against a sample string.
- Find a dictionary, a file of words. Linux has one at
/usr/share/dict/words. Learn how to make PHP
read the file word at a time.
- Using regular expression, find words with various
interesting properties: a word with all the vowels
in proper order; a word whose first 2 letters are the
same as its last 2 letters; a word with a pair of
vowels twice.
- For some of these you will need to use the parenthesis
operation. This is a part of most regular expression
syntax where a match is memorized and recalled later in
the match string. Prove that using this, you can
match strings which are not regular!
I'll most more details as the week goes on.