——总结自廖雪峰网站
匹配任意字符
“.”可以匹配任意一个字符
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