110,538
社区成员
发帖
与我相关
我的任务
分享
string temp = "ContractName='aaaaa',contractRole='Web master',CtUpdate='02/02/2012',update=now(),ssss='sdsass',ttt=2";
string[] result = Regex.Matches(temp, @"(?<=='?)[^',]+(?='|,|\s|$)").Cast<Match>().Select(a => a.Value).ToArray();
/*
[0] "aaaaa" string
[1] "Web master" string
[2] "02/02/2012" string
[3] "now()" string
[4] "sdsass" string
[5] "2" string
*/
string temp = "ContractName='aaaaa',contractRole='Web master',CtUpdate='02/02/2012',update=now(),ssss='sdsass'";
string[] result = Regex.Matches(temp,@"(?<=='?)[^',\s]+(?='|,|\s)").Cast<Match>().Select(a=>a.Value).ToArray();
/*
[0] "aaaaa" string
[1] "Web" string
[2] "02/02/2012" string
[3] "now()" string
[4] "sdsass" string
*/