C#正则获取字符串的问题
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();