日期:2014-05-16 浏览次数:20400 次
using System.Text.RegularExpressions; //字符串 string str = "abc@yahoo.com alsdjfsaldjfa as a@yahoo.com asdf"; string pattern = @"\S+@yahoo.com"; Regex reg = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.Multiline); MatchCollection mc = reg.Matches(str); string[] result = new string[mc.Count]; for (int i = 0; i < mc.Count; i++) { result[i] = mc[i].ToString(); } //----测试 for (int i = 0; i < result.Length; i++) { Response.Write(result[i] + "<br />"); }
------解决方案--------------------
用javascript:
var str = "abc@yahoo.com alsdjfsaldjfa as a@yahoo.com asdf"; var reg = /\S+@yahoo.com/gi; var result = str.match(reg); //result为数组
------解决方案--------------------
现在一般人都注意了,邮箱都改成
abc#yahoo.com或
abc_yahoo.com等形式
这种采集的效果很难说了。