private Regex CreateRegex(XshdElement position, string regex, XshdRegexType regexType) { if (regex == null) { throw Error(position, "Regex missing"); } RegexOptions options = RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture; if (regexType == XshdRegexType.IgnorePatternWhitespace) { options |= RegexOptions.IgnorePatternWhitespace; } if (ignoreCase) { options |= RegexOptions.IgnoreCase; } try { return(new Regex(regex, options)); } catch (ArgumentException ex) { throw Error(position, ex.Message); } }
Regex CreateRegex(XshdElement position, string regex, XshdRegexType regexType) { if (regex == null) throw Error(position, "Regex missing"); RegexOptions options = RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture; if (regexType == XshdRegexType.IgnorePatternWhitespace) options |= RegexOptions.IgnorePatternWhitespace; if (ignoreCase) options |= RegexOptions.IgnoreCase; try { return new Regex(regex, options); } catch (ArgumentException ex) { throw Error(position, ex.Message); } }