throws XPathException {
String translated = "";
try {
if (syntax == NATIVE_SYNTAX) {
groupCount = 9;
pattern = new Regex(regex.toString(), setFlags(flags));
} else {
DotNetRegexTranslator translator = new DotNetRegexTranslator();
translated = translator.translate(
regex, xmlVersion, syntax==XPATH_SYNTAX, isIgnoreWhitespace(flags), isCaseBlind(flags));
groupCount = translator.getNumberOfCapturedGroups();
pattern = new Regex(translated, setFlags(flags));
}
//noinspection ConstantIfStatement
if (false) {
// to keep the compiler happy
throw new ArgumentException();