using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"• (.+?)\s+- FF([A-F0-9]{2})([A-F0-9]{2})([A-F0-9]{2})";
string substitution = @"""$1"": [0x$2, 0x$3, 0x$4],";
string input = @" • White - FFe4e4e4
• Light Gray - FFa0a7a7
• Dark Gray - FF414141
• Black - FF181414
• Red - FF9e2b27
• Orange - FFea7e35
• Yellow - FFc2b51c
• Lime Green - FF39ba2e
• Green - FF364b18
• Light Blue - FF6387d2
• Cyan - FF267191
• Blue - FF253193
• Purple - FF7e34bf
• Magenta - FFbe49c9
• Pink - FFd98199
• Brown - FF56331c";
RegexOptions options = RegexOptions.Multiline | RegexOptions.IgnoreCase;
Regex regex = new Regex(pattern, options);
string result = regex.Replace(input, substitution);
}
}
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