正则 查找字符 并替换
如字符串:"asdasd:"123" , a:"null""
替换成"asdasd:"123" , a:null"
[解决办法]
String str_content = ""asdasd:"123" , a:"null""";
String model="";
Pattern pattern2 = Pattern.compile("a:"null""");
Matcher matcher2 = pattern2.matcher(str_content);
if (matcher2.find()) {
model=matcher2.replaceAll("a:null"");
}
String str_content = "asdasd:"123" , a:"null"";
String model="";
Pattern pattern2 = Pattern.compile(":"null"");
Matcher matcher2 = pattern2.matcher(str_content);
if (matcher2.find()) {
model=matcher2.replaceAll(":null");
}
System.out.println(model);
}