Rewrite regexCheck to support Regex comparison.