internal class Program
{
private static void Main(string[] args)
{
var content = Read(@"E:\workspace\日志\2016-06-21.LOG2016-06-21.LOG");
Regex reg3 = new Regex(@"手机号(?<result>(\d+)?)");
var matches = reg3.Matches(content);
if (matches.Count > 0)
{
var list = new List<string>();
string phone;
foreach (Match item in matches)
{
phone = item.Result("${result}");
if (list.Contains(phone))
{
}
else
{
list.Add(phone);
}
}
}
}
public static string Read(string path)
{
StreamReader sr = new StreamReader(path, Encoding.Default);
String line;
StringBuilder sb = new StringBuilder();
while ((line = sr.ReadLine()) != null)
{
sb.AppendLine(line);
}
return sb.ToString();
}
}