废话不多说,都在代码中,直接上
JS代码:
代码如下:
C#代码:
代码如下:
文字" mce_href=\"cc> href=\"" cbas cchref 1" mce_href=\">";
Regex reg = new Regex("]+[\\s]+)href=(\"(?[^<>\"']*)\"|'(?[^<>\"']*)')[^<>]*>",RegexOptions.IgnoreCase);
MatchCollection matchCollection = reg.Matches(html);
MessageBox.Show(matchCollection.Count.ToString());
foreach (Match match in matchCollection)
{
MessageBox.Show(match.Groups["href"].ToString());
}
小伙伴们是否了解了js及C#中使用正则表达式的异同点呢?有疑问的请留言,大家共同讨论。