GUID Pattern support in RegexMatcher (#699)

* Add the RegexGuid class

* Use of RegexGuid in the RegexMatcher

* Fix up the CodeFactor violations

* Rename RegexGuid --> RegexExtended
This commit is contained in:
Michael Brogdon
2021-12-11 02:57:15 -07:00
committed by GitHub
parent 3dafd2e725
commit 4a434b5dba
3 changed files with 175 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ using AnyOfTypes;
using JetBrains.Annotations;
using WireMock.Extensions;
using WireMock.Models;
using WireMock.RegularExpressions;
using WireMock.Validation;
namespace WireMock.Matchers
@@ -17,7 +18,7 @@ namespace WireMock.Matchers
public class RegexMatcher : IStringMatcher, IIgnoreCaseMatcher
{
private readonly AnyOf<string, StringPattern>[] _patterns;
private readonly Regex[] _expressions;
private readonly RegexExtended[] _expressions;
/// <inheritdoc cref="IMatcher.MatchBehaviour"/>
public MatchBehaviour MatchBehaviour { get; }
@@ -76,7 +77,7 @@ namespace WireMock.Matchers
options |= RegexOptions.IgnoreCase;
}
_expressions = patterns.Select(p => new Regex(p.GetPattern(), options)).ToArray();
_expressions = patterns.Select(p => new RegexExtended(p.GetPattern(), options)).ToArray();
}
/// <inheritdoc cref="IStringMatcher.IsMatch"/>