Compile Regex only once

Regular expressions in `Substitute` commands are compiled all over whenever one such command is executed. In order to avoid redundant compilation, this change moves the corresponding parts to the parsing site.