Originally Posted by
whiteflags
Hmm... well the fields you want are wrapped in quotes so `[^`]*` should match all the fields.
Thanks! That helped. My solution is fugly, but it works:
Code:
string pattern = @"`[^`]*`";
MatchCollection pkeys = Regex.Matches("(`field4`(255),`email`(255))", pattern);
string pkey = "";
bool first = true;
StringBuilder sb1 = new StringBuilder();
foreach (Match pk in pkeys)
{
GroupCollection gc = pk.Groups;
if (!first) sb1.Append(",");
first = false;
sb1.Append(gc[0].Value.Replace("`",""));
}
pkey = sb1.ToString(); //"field4,email"