Compile a regular expression