mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-02-25 19:54:51 +01:00
* Lower priority from Proxy mappings * Fix codefactor * extra tests * #205 * Fix test for linux * `c:\temp\x.json` fix * Extra tests * more tests * more tests * codefactor * #200 * refactor * refactor * tests
25 lines
715 B
C#
25 lines
715 B
C#
using System.Collections.Generic;
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace WireMock.Util
|
|
{
|
|
internal static class RegexUtils
|
|
{
|
|
public static Dictionary<string, string> GetNamedGroups(Regex regex, string input)
|
|
{
|
|
var namedGroupsDictionary = new Dictionary<string, string>();
|
|
|
|
GroupCollection groups = regex.Match(input).Groups;
|
|
foreach (string groupName in regex.GetGroupNames())
|
|
{
|
|
if (groups[groupName].Captures.Count > 0)
|
|
{
|
|
namedGroupsDictionary.Add(groupName, groups[groupName].Value);
|
|
}
|
|
}
|
|
|
|
return namedGroupsDictionary;
|
|
}
|
|
}
|
|
}
|