作业
来源:互联网 发布:wave动作数据mmd 编辑:程序博客网 时间:2024/05/19 15:43
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class TestPattern {
public static void main(String[] args) {
// Pattern p =Pattern.compile("a*b");//获取到了正则表达式
// Matcher m = p.matcher("aaaaab");//返回上一个匹配到Matcher
// boolean b = m.matches();//看是否能匹配,匹配就返回true;
// System.out.println(b);
// System.out.println("aaaaaab".matches("a*b"));
String s = "我的手机号18810125973 曾经用过15641625485 还用过17600313836";
String regex = "1[3578]\\d{9}";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(s);
// boolean b = m.find();
// System.out.println(b);
while (m.find()) {
System.out.println(m.group());
}
}
}
阅读全文
0 0
- 作业
- 作业
- 作业
- 作业
- 作业
- 作业
- 作业
- 作业
- 作业
- 作业
- 作业~~~~~~~~~~~~~
- 作业
- 作业
- 作业
- 作业
- 作业
- 作业
- 作业
- JSONObject 的使用
- jvm系列(七):jvm调优-工具篇
- 记HTML5 <a> 标签的一个小坑
- kettle设置数据库连接变量、js脚本设置变量、数据流合并、设置分支等
- mycat2.0配置文件 datasource.yml说明
- 作业
- Linux命令分析:tar
- android studio 常用快捷键
- 众里寻他千百度 哪家单位让你再见如初?这里上市公司、股份集团任你选 | 大数据周聘汇
- 马云要让“千亿达摩院”具备盈利能力,能做到吗?
- 【案例】中国银联、光大银行基于区块链的可信电子凭证系统
- Expected one result (or null) to be returned by selectOne(), but found: 4
- Linux中表示“时间”的结构体和相关函数
- C#生成唯一值的方法汇总