日期:2014-05-18 浏览次数:21028 次
string s = @"sdwqdhwqkghkg321 dsw wq dwq { name:""我dni单位"",dwqdwquidwq";
System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"name:""(?<value>\w*\W*)""");
System.Text.RegularExpressions.Match m = reg.Match(s);
MessageBox.Show(m.Groups["value"].Value);
------解决方案--------------------
string str = @"sdwqdhwqkghkg321 dsw wq dwq { name:""我dni单位"",dwqdwquidwq";
Regex re = new Regex(@"(?is)(?<=name:"")[^""]+(?="")", RegexOptions.None);
MatchCollection mc = re.Matches(str);
foreach (Match ma in mc)
{
//ma.Value就是你要的值
}