日期:2014-05-17 浏览次数:20424 次
string str = "abcdef";
string v = @"b(\w+)e";
Regex rg = new Regex(v, RegexOptions.IgnoreCase | RegexOptions.Singleline);
string str2 = "";
//str2 = rg.Match(str).Value;
//MessageBox.Show(str2);
str2 = rg.Match(str).Groups[0].Value.ToString();
MessageBox.Show(str);
string str = "abcdef";
string v = @"b(?<txt>\w+)e";
Regex rg = new Regex(v, RegexOptions.IgnoreCase
------解决方案--------------------
RegexOptions.Singleline);
string str2 = "";
str2 = rg.Match(str).Groups["txt"].Value.ToString();