using System.Text.RegularExpressions;
public static void Main()
string pattern = @"^\[\w+]\s.+$";
string text= "[Keys]\nW, A, S, D";
TestMatch(pattern, text);
text = "[Cat]\nBrown, Black, white";
TestMatch(pattern, text);
text = "[Uh_Oh_Spaghettios]\nThis is some text, Same, So is this";
TestMatch(pattern, text);
Console.WriteLine("Done");
private static void TestMatch(string pattern, string text){
Console.WriteLine("Testing text...");
var match = Regex.Match(text, pattern);
Console.WriteLine(match);
Console.WriteLine("Nope :(");