正则获取字符串中两个字符串间的内容

/// <summary>
/// 正则获取字符串中两个字符串间的内容
/// </summary>
/// <param name="str"></param>
/// <param name="s"></param>
/// <param name="e"></param>
/// <returns></returns>
public static string GetValue(string str, string s, string e)
{
Regex rg = new Regex("(?<=(" + s + "))[.\s\S]*?(?=(" + e + "))", RegexOptions.Multiline | RegexOptions.Singleline);
Match matchs = rg.Match(str);

return matchs.Groups[0].Value + matchs.Groups[2].Value;
}

原文地址:https://www.cnblogs.com/wolf12/p/5385628.html