Here you can find the source of replace(String value)
private static String replace(String value)
//package com.java2s; //License from project: Apache License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private static final Pattern VAR_PTN = Pattern.compile("\\$\\{([^\\}]+)\\}"); private static String replace(String value) { if (value == null) return null; StringBuffer sb = new StringBuffer(256); Matcher m = VAR_PTN.matcher(value); while (m.find()) { String propValue = System.getProperty(m.group(1)); if (propValue == null) propValue = ""; m.appendReplacement(sb, Matcher.quoteReplacement(propValue)); }//from w w w. j a v a 2 s . c o m m.appendTail(sb); return sb.toString(); } }