Constructing regexps
Okay, so we now know that reading regular expressions can be hard. Writing them, however, is seductively easy. Try the following:
- Write a regular expression that detects whether a string is in the shallow form of an Internet e-mail address.
- Write a subroutine that takes a list of strings and prints all lines that contain a citation, where a citation is a string in parenthesis with a name or list of slash-separated names, followed by a year. Assume names are all alphabetical words.
- What if a citation is in the LaTeX form: \cite{key}?
- Write a routine that parses and evaluates a Scheme expression consisting of (possibly nested) binary addition and multiplication operations on literal numbers. (No symbolic simplification required.)