正则表达式——java实现

——总结自廖雪峰网站

匹配任意字符

“.”可以匹配任意一个字符

String re1 = "a.c";
System.out.println("abc".matches(re1));
System.out.println("a1c".matches(re1));
System.out.println("a*c".matches(re1));
System.out.println("ac".matches(re1));
System.out.println("abbc".matches(re1));

输出为

true
true
true
false
false

猜你喜欢

转载自www.cnblogs.com/lixiaoxu/p/12536758.html