A wrapper to validate regular expressions and handle PCRE warnings.