public Pattern(string expression, bool ignoreCase, bool global) { Flags = ignoreCase ? MatcherFlags.IgnoreCase : 0; Flags = global ? Flags | MatcherFlags.Global : Flags; _hasEndAnchor = expression[expression.Length - 1].Equals('$'); _hasStartAnchor = expression[0].Equals('^'); int start = _hasStartAnchor ? 1 : 0; int end = (_hasEndAnchor ? 1 : 0) + start; RootExpression = RegularExpression.Parse(expression.Substring(start, expression.Length - end)); _description = AssembleDescription(); }
public Pattern(string expression, bool ignoreCase = false, bool global = false) { if (expression == null) { throw new ArgumentNullException(); } Flags = ignoreCase ? MatcherFlags.IgnoreCase : 0; Flags = global ? Flags | MatcherFlags.Global : Flags; AnchoredAtEnd = expression[expression.Length - 1].Equals('$'); AnchoredAtStart = expression[0].Equals('^'); var start = AnchoredAtStart ? 1 : 0; var end = (AnchoredAtEnd ? 1 : 0) + start; RootExpression = VBRegexParser.Parse(expression.Substring(start, expression.Length - end)); Description = AssembleDescription(); }