using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"# Parse Table grab from https://sashamaps.net/docs/resources/20-colors/
(?:
(?P<NAME>[A-Za-z]+)
\# (?P<HEX>[0-9a-fA-F]{6})
(?P<ID>\d+)
)";
string input = @"Red#e6194B1Green#3cb44b2Yellow#ffe1193Blue#4363d84Orange#f582315Purple#911eb46Cyan#42d4f47Magenta#f032e68Lime#bfef459Pink#fabed410Teal#46999011Lavender#dcbeff12Brown#9A632413Beige#fffac814Maroon#80000015Mint#aaffc316Olive#80800017Apricot#ffd8b118Navy#00007519Grey#a9a9a920White#ffffff21
Black#00000022";
RegexOptions options = RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx