using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
namespace 提取网页中的邮箱
{
class Program
{
static void Main(string[] args)
{
string str= File.ReadAllText(@"email.htm", Encoding.UTF8);
MatchCollection ms = Regex.Matches(str, @"([a-zA-Z0-9_]+)@(\w+)(\.[a-z]+)+");
if (ms.Count!=0)
{using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
namespace 提取网页中的邮箱
{
class Program
{
static void Main(string[] args)
{
string str= File.ReadAllText(@"email.htm", Encoding.UTF8);
MatchCollection ms = Regex.Matches(str, @"([a-zA-Z0-9_]+)@(\w+)(\.[a-z]+)+");
if (ms.Count!=0)
{
for (int i = 0; i < ms.Count;i++ )
{
if (ms[i].Success)
{
Console.WriteLine(ms[i].Value);
}
}
}
Console.ReadKey();
}
}
}
for (int i = 0; i < ms.Count;i++ )
{
if (ms[i].Success)
{
Console.WriteLine(ms[i].Value);
}
}
}
Console.ReadKey();
}
}
}
转载于:https://blog.51cto.com/net5x/1584833