public static void main(String[] a) {
String wpp = "select 1, ${mark} ‘``this is, `/message22` special mark`\" this is ${mark1} special mark\"‘ `/message` ${mark} ";
String pp = "((?=([^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)(?=([^\\\‘]*\\\‘[^\\\‘]*\\\‘)*[^\\\‘]*$))\\$\\{(.*?)}";
String th = wpp.replaceAll(pp, "77777");
System.out.println(th);
}
java正则匹配${xxx} 排除单引号双引号内的内容,前提引号必须成对出现
原文:https://www.cnblogs.com/shianliang/p/14626601.html