标签:
public void Regular_Expression() { WebClient wc = new WebClient(); // wc.Encoding = Encoding.Default; string str = wc.DownloadString("http://localhost:32768/想要上Facebook,twitter的童鞋报道,留下你的Email%20且听风吟%20电影.htm");//下载HTml文档 // 365169098@qq.com string regular = @"\w[a-zA-z0-9\-\._]+@[a-zA-z0-9\-_]+(\.[a-zA-Z0-9]+)+"; MatchCollection machs =System.Text.RegularExpressions.Regex.Matches(str,regular); int i = 0; List<string> lsit = new List<string>(); foreach (Match s in machs) { if (!lsit.Contains(s.Value)) { lsit.Add(s.Value); Console.WriteLine(i++ + " " + s.Value); } // Console.WriteLine(i++ +" "+s.Value); } }
标签:
原文地址:http://www.cnblogs.com/LY-Byfalt/p/4963575.html