Opitimize the regular expression.