Took advantage of the fact that the re module automatically caches the most recent regular expressions so no need to compile.