匹配手机号

 1             //FileStream fs = new FileStream(@"C:UsersAlexDesktopTask.txt", FileMode.Open, FileAccess.Read);
 2             //StreamReader sr = new StreamReader(fs);
 3 
 4             #region "Read Content"
 5             StreamReader sr = new StreamReader(@"C:UsersAlexDesktopTask.txt", Encoding.GetEncoding("gb2312"));
 6             string content = sr.ReadToEnd();
 7 
 8             sr.Close();
 9 
10             Console.WriteLine(content);
11 
12             Regex rx = new Regex(@"1[3-8]d{9}");
13             MatchCollection matches = rx.Matches(content);
14             Console.WriteLine(matches.Count);
15             foreach (Match match in matches)
16             {
17                 Console.WriteLine(match.Value);
18             }
19             Console.ReadKey();
20             #endregion
原文地址:https://www.cnblogs.com/daishuguang/p/3763784.html