Copied interesting regular expression example.

From http://www.cs.princeton.edu/courses/archive/spr09/cos333/beautiful.html