我想從字符串中的html代碼中提取電子郵件「myemail [at] domainemail [dot] com」。正則表達式在[at]中的電子郵件地址
所以我用這個代碼,但它不工作。我該怎麼辦 ?
public static List<string> Fetch_Emails(string Sourcecode)
{
List<string> Emails = new List<string>();
Regex exp = new Regex("\\b[A-Z0-9._%+-]+(\\[at\\])[A-Z0-9.-]+(\\[dot\\])[A-Z]{2,4}\\b", RegexOptions.IgnoreCase);
MatchCollection matchCollection = exp.Matches(Sourcecode);
foreach (Match m in matchCollection)
{
if (!Emails.Contains(m.Value))
{
Emails.Add(m.Value);
}
}
return Emails;
}
沒有針對此問題沒有_simple_正則表達式。見LB鏈接的問題 – Krease