正则判断字符是否包含手机号

字符前后不能是数字,满足手机号标准

bash 复制代码
String msg ="19009098989";
    String mobliePattern = "((?<!\\d))(mobile|手机号|)(=|=\\[|\\\":\\\"|:|:|='|':'|)(1)([3-9]{1}\\d{1})(\\d{4})(\\d{4})(\\]|\\\"|'|)((?!\\d))";
    String mobileReplace = "$1$2$3$4****$6";
    Pattern regex = attern.compile(mobliePattern);
    Matcher matcher = regex.matcher(msg);
        if (matcher.find()) {
           System.out.println(matcher.replaceAll(mobileReplace));
        }
相关推荐
考虑考虑几秒前
kafka4安装
后端·kafka·自动化运维
orient7 分钟前
慢查询优化 10 招:从 EXPLAIN 到索引重建
后端
用户409666013175121 分钟前
MySQL 事务与锁机制实战:从隔离级别到死锁排查
后端
zhangxingchao36 分钟前
AI应用开发九:从 Hermes Agent 学长期记忆
前端·人工智能·后端
默默敲代码的徐哥儿1 小时前
八股文整理——后端
java·开发语言·spring boot·后端·学习
自由的裙子1 小时前
ASP.NET路由模型解析
后端·asp.net
k↑1 小时前
SpringCloud + React19 集成Scalar的API文档
后端·spring·spring cloud
Mandy的名字被占用了1 小时前
Dart 与 Flutter 快速入门指南
后端·flutter·dart
货拉拉技术2 小时前
基于eBPF的主机安全探索与实践
后端
梨子同志2 小时前
Spring Security
后端