日期:2014-05-17 浏览次数:20508 次
StreamReader reader = new StreamReader("e:\\1.txt"); string content = reader.ReadToEnd(); System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"(?<=<a href=""[^""]*?)[^""]+(?="")"); System.Text.RegularExpressions.MatchCollection ms = reg.Matches(content); foreach (System.Text.RegularExpressions.Match m in ms) { MessageBox.Show(m.Value); }
------解决方案--------------------
(?i)<a\b[^>]*href=(["'\s]?)(.*?)\1[^>]*>
取第二个分组,Groups[2].Value