C#遍历正则匹配到的多个结果的代码

把开发过程中比较重要的内容片段收藏起来,如下内容是关于C#遍历正则匹配到的多个结果的内容,应该是对大家有一些用处。

Regex regex = new Regex(strPattern, RegexOptions.IgnoreCase | RegexOptions.Multiline);
    if (regex.IsMatch(htmlContent))
    {
        MatchCollection matchCollection = regex.Matches(htmlContent);
        foreach (Match match in matchCollection)
        {
        }
    }

猜你喜欢

转载自blog.csdn.net/weixin_44183620/article/details/85111998
今日推荐