public override int Match(MatchContent content) { var count = _inner.Match(content); if (count == NotMatch) { return(NotMatch); } var g = content.GetGroup(_groupName); if (g == null) { return(NotMatch); } switch (_comparsion) { case LengthComparison.Equals: return(count == g.Value.Count ? count : NotMatch); case LengthComparison.LessThan: return(count < g.Value.Count ? count : NotMatch); case LengthComparison.GreaterThan: return(count > g.Value.Count ? count : NotMatch); case LengthComparison.LessThanOrEquals: return(count <= g.Value.Count ? count : NotMatch); case LengthComparison.GreaterThanOrEquals: return(count >= g.Value.Count ? count : NotMatch); default: throw new InvalidOperationException(); } }
public MatchGroup?GetGroup(string name) { if (name == null) { throw new ArgumentNullException(nameof(name)); } return(_mc.GetGroup(name)); }