所以我想替换正常的电子邮件,例如:"teste123@test.com"
“teste123< b style ='display:none;' > null< / b> @ test.com“`
string expression = @"(([^<>()\[\]\\.,;:\s@']+(\.[^<>()\[\]\\.,;:\s@']+)*)|('.+'))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))";
Regex rx = new Regex(expression);
MatchCollection matches = rx.Matches(conteudo.PaginaConteudo);
Console.WriteLine("{0} matches found in:\n {1}",
matches.Count,
conteudo.PaginaConteudo);
string email,
replacement = "<h5 style='display:none;'>null</h5>",
mailenc,
correctString;
foreach (Match emails in matches)
{
email = emails.Value;
mailenc = "<h5>"+email + replacement+"</h5>";
correctString = conteudoOriginal.PaginaConteudo.Replace(email, mailenc);
conteudoOriginal.PaginaConteudo = correctString;
}
答案 0 :(得分:1)
email = emails.Value.Replace("@","<b style='display:none;'>null</b>@");