I've managed to find the Regex to get almost the result I want here i.e.
Regex r1 = new Regex(@"\[(.*?)\]");
string row = HEADERNAMES[COL1,COL2,COL3,COL4];
Match match = r1.Match(row);
string result = match.ToString();
Outputs: "[COL1,COL2,COL3,COL4]";
I know I can then use:
result.Replace("[", "");
result.Replace("]", "");
to get exactly what I want but I was wondering if there was a way to ommit the delimeters [ and ] from the Regex result without performing the String methods.
I would have thought there was a more elegant solution using Regex itself??
Thanks in advance.