Pre-compile regexes

Pre-compile regexes at program startup for faster pattern matching. No other functional changes.

Closes #7.