wolf12

/// <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;
}

分类:

技术点:

相关文章:

  • 2021-09-17
  • 2021-10-09
  • 2021-10-09
  • 2021-10-09
  • 2021-10-09
  • 2021-10-09
  • 2021-10-09
  • 2022-01-10
猜你喜欢
  • 2021-10-09
  • 2021-10-09
  • 2021-10-09
  • 2021-10-09
  • 2021-10-09
  • 2021-11-26
  • 2021-10-09
相关资源
相似解决方案