企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
1>.matches(String regex)方法   作用:告知此字符串是否匹配给定的正则表达式。 2>.split(String regex)方法   作用:根据给定正则表达式的匹配拆分此字符串。 3>.replaceAll(String regex,String replacenent)方法   作用:使用给定的replacement替换此字符串所有匹配给定的正则表达式的子字符串。 4>.匹配正确的数字 ![](https://box.kancloud.cn/3d4ae77d1146334ff4ed15544ded8538_564x167.png) 用法如下: ~~~ String str = "xxxxxxxxxxx"; Boolean b = str.matches("正则表达式"); System.out.println(b); ~~~