Precompile regular expressions, add code comments