网站首页 > 技术文章 正文
网上找到一段代码,使用后发现错误,不能用。现已改正,亲测可用!
private bool CheckPhoneIsAble(string input)
{
if (input.Length < 11)
{
return false;
}
//电信手机号码正则
string dianxin = @"^1[3578][01379]\d{8}#34;;
Regex regexDX = new Regex(dianxin);
//联通手机号码正则
string liantong = @"^1[34578][01256]\d{8}#34;;
Regex regexLT = new Regex(liantong);
//移动手机号码正则
string yidong = @"^(1[012345678]\d{8}|1[345678][012356789]\d{8})#34;;
Regex regexYD = new Regex(yidong);
if (regexDX.IsMatch(input) || regexLT.IsMatch(input) || regexYD.IsMatch(input))
{
return true;
}
else
{
return false;
}
}
猜你喜欢
- 2024-09-15 C#内插字符串(c# 字符串)
- 2024-09-15 C#中动态编译并执行字符串代码,类似javascript中的eval方法
- 2024-09-15 精通C#整数转字符串:多种方法解密填充零的奥秘
- 2024-09-15 一个超实用随机字符串生成方法,超经典!
- 2024-09-15 C# Win Form 字符串函数与正则表达式取子串
- 2024-09-15 c#正则判断字符串是否为mac地址(c# 正则表达式判断字符串是否全是数字)
- 2024-09-15 C# 基础知识系列- 13 常见类库介绍(二)日期时间类
- 2024-09-15 揭秘:带引号的字符串字面量的魅力与用途!
- 2024-09-15 C#中的转义符与原始字符串(c# &转义)
- 2024-09-15 c#将一个字符串加入到已有的字符串组中
- 最近发表
- 标签列表
-
- cmd/c (90)
- c++中::是什么意思 (84)
- 标签用于 (71)
- 主键只能有一个吗 (77)
- c#console.writeline不显示 (95)
- pythoncase语句 (88)
- es6includes (74)
- sqlset (76)
- apt-getinstall-y (100)
- node_modules怎么生成 (87)
- chromepost (71)
- flexdirection (73)
- c++int转char (80)
- mysqlany_value (79)
- static函数和普通函数 (84)
- el-date-picker开始日期早于结束日期 (76)
- js判断是否是json字符串 (75)
- c语言min函数头文件 (77)
- asynccallback (87)
- localstorage.removeitem (74)
- vector线程安全吗 (70)
- java (73)
- js数组插入 (83)
- mac安装java (72)
- 无效的列索引 (74)