码迷,mamicode.com
首页 > 移动开发 > 详细

匹配手机号

时间:2014-06-02 01:33:21      阅读:298      评论:0      收藏:0      [点我收藏+]

标签:des   c   style   class   blog   code   

bubuko.com,布布扣
 1             //FileStream fs = new FileStream(@"C:\Users\Alex\Desktop\Task.txt", FileMode.Open, FileAccess.Read);
 2             //StreamReader sr = new StreamReader(fs);
 3 
 4             #region "Read Content"
 5             StreamReader sr = new StreamReader(@"C:\Users\Alex\Desktop\Task.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
bubuko.com,布布扣

 

匹配手机号,布布扣,bubuko.com

匹配手机号

标签:des   c   style   class   blog   code   

原文地址:http://www.cnblogs.com/daishuguang/p/3763784.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!