string s = @"^(13[0-9]|15[0|3|6|8|9])\d{8}$";
第1个回答 2013-06-23
我是在网站上抄的,应该对巴。
现在的手机号码增加了150,153,156,158,159
所以正则表达式如下: string s = @"^(13[0-9]|15[0|3|6|8|9])\d{8}$";
验证代码:
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string s = @"^(13[0-9]|15[0|3|6|8|9])\d{8}$";
while (true)
{
string input = Console.ReadLine();
if (Regex.IsMatch(input, s))
{
MessageBox.Show("完全符合!");
}
else
{
MessageBox.Show("不符合!");
}
}
}
}
}
现在的手机号码增加了150,153,156,158,159
所以正则表达式如下: string s = @"^(13[0-9]|15[0|3|6|8|9])\d{8}$";
验证代码:
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string s = @"^(13[0-9]|15[0|3|6|8|9])\d{8}$";
while (true)
{
string input = Console.ReadLine();
if (Regex.IsMatch(input, s))
{
MessageBox.Show("完全符合!");
}
else
{
MessageBox.Show("不符合!");
}
}
}
}
}