Exercises in implementing regular-expression search