public boolean matches(String regex):字符串匹配
public String replaceAll(String regex,String replacement):字符串替换
public String[] split(String regex):字符串拆分
package com.hephec
public class RegexDemo{
public static void main(String[] args){
String str1="A!B2C3D4afeiawfeaawefafef54".replaceAll("\\d+","_");
boolean temp="2014-10-19".matches("\\d{4}-\\d{2}-\\d{2}");
String[] str2="afhapfapfap32423pqnfaps".split("\\d+");
...
}
}
原文链接:https://www.f2er.com/regex/361278.html