Fix isRegex issue