replace():不可以正则
replaceAll()参数十一正则
replaceFirst()参数是一个正则,匹配第一次出现的
package entity;
public class Test2 {
public static void main(String[] args) {
String src = new String("ab43a2c43d");
System.out.println(src.replace("ab43a2c43d", "f"));//f
System.out.println(src.replace('3', 'f'));//ab4fa2c4fd
System.out.println(src.replaceAll("\\d", "f"));//abffafcffd
System.out.println(src.replaceFirst("\\d", "5"));//ab53a2c43d
}
}