@@ -0,0 +1,800 @@
+package com.asksunny.tool;%0A%0Aimport java.util.Map;%0Aimport java.util.regex.Matcher;%0Aimport java.util.regex.Pattern;%0A%0Apublic class SearchReplaceUtils %7B%0A%09private static final Pattern SYS_PROP_PATTERN = Pattern%0A%09%09%09.compile(%22%5C%5C$%5C%5C%7B(%5B%5E%5C%5C%7B%5C%5C%7D%5D+)%5C%5C%7D%22);%0A%09%0A%09%0A%09public static String searchAndReplace(CharSequence text,%0A%09%09%09Map%3CString, String%3E props) %7B%0A%09%09Matcher matcher = SYS_PROP_PATTERN.matcher(text);%0A%09%09StringBuffer buf = new StringBuffer();%0A%09%09while (matcher.find()) %7B%0A%09%09%09String key = matcher.group(1);%0A%09%09%09String value = props.get(key);%0A%09%09%09if (value != null) %7B%0A%09%09%09%09if (SYS_PROP_PATTERN.matcher(value).find()) %7B%0A%09%09%09%09%09value = searchAndReplace(value, props);%0A%09%09%09%09%7D%0A%09%09%09%09matcher.appendReplacement(buf, value);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09matcher.appendTail(buf);%0A%09%09return buf.toString();%0A%09%7D%0A%09%0A%09private SearchReplaceUtils() %7B%09%09%0A%09%7D%0A%0A%7D%0A

Create SearchReplaceUtils.java