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);
}