c# 用正则表达式获取开始和结束字符串中间的值

 1 /// 
 2 /// 获得字符串中开始和结束字符串中间得值
 3 /// 
 4 /// 字符串
 5 /// 开始
 6 /// 结束
 7 ///  
 8 public static string GetValue(string str, string s, string e)
 9 {
10 Regex rg = new Regex("(?<=(" + s + "))[.\\s\\S]*?(?=(" + e + "))", RegexOptions.Multiline | RegexOptions.Singleline);
11 return rg.Match(str).Value;
12 }

 

转载于:https://www.cnblogs.com/iChina/p/5217701.html

你可能感兴趣的:(c# 用正则表达式获取开始和结束字符串中间的值)