| | | 1 | | using System.Linq; |
| | | 2 | | using System.Text.RegularExpressions; |
| | | 3 | | using JetBrains.Annotations; |
| | | 4 | | |
| | | 5 | | namespace WireMock.Matchers |
| | | 6 | | { |
| | | 7 | | /// <summary> |
| | | 8 | | /// WildcardMatcher |
| | | 9 | | /// </summary> |
| | | 10 | | /// <seealso cref="RegexMatcher" /> |
| | | 11 | | public class WildcardMatcher : RegexMatcher |
| | | 12 | | { |
| | | 13 | | private readonly string[] _patterns; |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// Initializes a new instance of the <see cref="WildcardMatcher"/> class. |
| | | 17 | | /// </summary> |
| | | 18 | | /// <param name="pattern">The pattern.</param> |
| | | 19 | | /// <param name="ignoreCase">IgnoreCase</param> |
| | 158 | 20 | | public WildcardMatcher([NotNull] string pattern, bool ignoreCase = false) : this(new [] { pattern }, ignoreCase) |
| | 158 | 21 | | { |
| | 158 | 22 | | } |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// Initializes a new instance of the <see cref="WildcardMatcher"/> class. |
| | | 26 | | /// </summary> |
| | | 27 | | /// <param name="patterns">The patterns.</param> |
| | | 28 | | /// <param name="ignoreCase">IgnoreCase</param> |
| | 323 | 29 | | public WildcardMatcher([NotNull] string[] patterns, bool ignoreCase = false) : base(patterns.Select(pattern => " |
| | 161 | 30 | | { |
| | 161 | 31 | | _patterns = patterns; |
| | 161 | 32 | | } |
| | | 33 | | |
| | | 34 | | /// <inheritdoc cref="IStringMatcher.GetPatterns"/> |
| | | 35 | | public override string[] GetPatterns() |
| | 2 | 36 | | { |
| | 2 | 37 | | return _patterns; |
| | 2 | 38 | | } |
| | | 39 | | |
| | | 40 | | /// <inheritdoc cref="IMatcher.GetName"/> |
| | | 41 | | public override string GetName() |
| | 1 | 42 | | { |
| | 1 | 43 | | return "WildcardMatcher"; |
| | 1 | 44 | | } |
| | | 45 | | } |
| | | 46 | | } |