# Summary

Class: | WireMock.Matchers.RegexMatcher
Assembly: | WireMock.Net
File(s): | C:\Users\azureuser\Documents\Github\WireMock.Net\src\WireMock.Net\Matchers\RegexMatcher.cs
Covered lines: | 28
Uncovered lines: | 4
Coverable lines: | 32
Total lines: | 81
Line coverage: | 87.5%
Branch coverage: | 100%

# Metrics

Method | Cyclomatic complexity | NPath complexity | Sequence coverage | Branch coverage
--- | --- | --- | --- | ---
.ctor(...) | 1 | 0 | 100 | 100
.ctor(...) | 2 | 2 | 100 | 100
IsMatch(...) | 2 | 2 | 70 | 100
GetPatterns() | 1 | 0 | 100 | 100
GetName() | 1 | 0 | 100 | 100

# File(s)

## C:\Users\azureuser\Documents\Github\WireMock.Net\src\WireMock.Net\Matchers\RegexMatcher.cs

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `using System;`
|  | `2` |  | `using System.Linq;`
|  | `3` |  | `using System.Text.RegularExpressions;`
|  | `4` |  | `using JetBrains.Annotations;`
|  | `5` |  | `using WireMock.Validation;`
|  | `6` |  | ``
|  | `7` |  | `namespace WireMock.Matchers`
|  | `8` |  | `{`
|  | `9` |  | `/// <summary>`
|  | `10` |  | `/// Regular Expression Matcher`
|  | `11` |  | `/// </summary>`
|  | `12` |  | `/// <seealso cref="IStringMatcher" />`
|  | `13` |  | `public class RegexMatcher : IStringMatcher, IIgnoreCaseMatcher`
|  | `14` |  | `{`
|  | `15` |  | `private readonly string[] _patterns;`
|  | `16` |  | `private readonly Regex[] _expressions;`
|  | `17` |  | ``
|  | `18` |  | `/// <summary>`
|  | `19` |  | `/// Initializes a new instance of the <see cref="RegexMatcher"/> class.`
|  | `20` |  | `/// </summary>`
|  | `21` |  | `/// <param name="pattern">The pattern.</param>`
|  | `22` |  | `/// <param name="ignoreCase">IgnoreCase</param>`
| 101 | `23` |  | `public RegexMatcher([NotNull, RegexPattern] string pattern, bool ignoreCase = false) : this(new [] { pattern },`
| 101 | `24` |  | `{`
| 101 | `25` |  | `}`
|  | `26` |  | ``
|  | `27` |  | `/// <summary>`
|  | `28` |  | `/// Initializes a new instance of the <see cref="RegexMatcher"/> class.`
|  | `29` |  | `/// </summary>`
|  | `30` |  | `/// <param name="patterns">The patterns.</param>`
|  | `31` |  | `/// <param name="ignoreCase">IgnoreCase</param>`
| 263 | `32` |  | `public RegexMatcher([NotNull, RegexPattern] string[] patterns, bool ignoreCase = false)`
| 263 | `33` |  | `{`
| 263 | `34` |  | `Check.NotNull(patterns, nameof(patterns));`
|  | `35` |  | ``
| 263 | `36` |  | `_patterns = patterns;`
| 263 | `37` |  | `IgnoreCase = ignoreCase;`
|  | `38` |  | ``
| 263 | `39` |  | `RegexOptions options = RegexOptions.Compiled;`
| 263 | `40` |  | `if (ignoreCase)`
| 28 | `41` |  | `{`
| 28 | `42` |  | `options |= RegexOptions.IgnoreCase;`
| 28 | `43` |  | `}`
|  | `44` |  | ``
| 528 | `45` |  | `_expressions = patterns.Select(p => new Regex(p, options)).ToArray();`
| 263 | `46` |  | `}`
|  | `47` |  | ``
|  | `48` |  | `/// <inheritdoc cref="IStringMatcher.IsMatch"/>`
|  | `49` |  | `public double IsMatch(string input)`
| 216 | `50` |  | `{`
| 216 | `51` |  | `if (input == null)`
| 1 | `52` |  | `{`
| 1 | `53` |  | `return MatchScores.Mismatch;`
|  | `54` |  | `}`
|  | `55` |  | ``
|  | `56` |  | `try`
| 215 | `57` |  | `{`
| 647 | `58` |  | `return MatchScores.ToScore(_expressions.Select(e => e.IsMatch(input)));`
|  | `59` |  | `}`
| 0 | `60` |  | `catch (Exception)`
| 0 | `61` |  | `{`
| 0 | `62` |  | `return MatchScores.Mismatch;`
|  | `63` |  | `}`
| 216 | `64` |  | `}`
|  | `65` |  | ``
|  | `66` |  | `/// <inheritdoc cref="IStringMatcher.GetPatterns"/>`
|  | `67` |  | `public virtual string[] GetPatterns()`
| 2 | `68` |  | `{`
| 2 | `69` |  | `return _patterns;`
| 2 | `70` |  | `}`
|  | `71` |  | ``
|  | `72` |  | `/// <inheritdoc cref="IMatcher.GetName"/>`
|  | `73` |  | `public virtual string GetName()`
| 1 | `74` |  | `{`
| 1 | `75` |  | `return "RegexMatcher";`
| 1 | `76` |  | `}`
|  | `77` |  | ``
|  | `78` |  | `/// <inheritdoc cref="IIgnoreCaseMatcher.IgnoreCase"/>`
| 0 | `79` |  | `public bool IgnoreCase { get; }`
|  | `80` |  | `}`
|  | `81` |  | `}`

# Methods/Properties

.ctor(System.String,System.Boolean)
.ctor(System.String[],System.Boolean)
IsMatch(System.String)
GetPatterns()
GetName()
IgnoreCase()