aspnetcore/src/Microsoft.AspNetCore.Rewrite/Internal/PatternSegments/RuleMatchSegment.cs

21 lines
623 B
C#

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments
{
public class RuleMatchSegment : PatternSegment
{
private readonly int _index;
public RuleMatchSegment(int index)
{
_index = index;
}
public override string Evaluate(RewriteContext context, MatchResults ruleMatch, MatchResults condMatch)
{
return ruleMatch?.BackReference[_index].Value;
}
}
}