Move regular expression compilation to a flag