using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"\b(?:G,C,D|A,B,C|E,C,D)|(?:[ABCDEFG](?:#|b)?)(?:\/[ABCDEFG]b)?(?:(?:(?:maj|min|sus|add|aug|dim)(?:\d{0,2}(?:#\d{1,2}|sus\d)?)?)|(?:m\d{0,2}(?:(?:maj|add|#)\d{0,2})?)|(?:-?\d{0,2}(?:\([^)]*\)|#\d{1,2})?))?";
string input = @"<p>Intro:G,C,D D, A, Em, Eb Ebb G G,C,D</p>
A,B,C <p><br />
Verse 1:</p> <p> D A Em <br />
Yeah I've iced down a few thousand beers in my days<br />
G <br />
You put down twice as many<br /> D A Em <br />
C9 G C#/Db C# Dsus2sus4
Dmaj13#11
Bmaj13#11
A7(b5,#9)
A7#9
B-5
#sus #maj #min #aug";
foreach (Match m in Regex.Matches(input, pattern))
{
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