static String expandEnvironmentVariables(String value){
  if (null == value) {
    return null;
  }
  Matcher m=ENV_VAR_PATTERN.matcher(value);
  StringBuffer sb=new StringBuffer();
  while (m.find()) {
    String envVarValue=null;
    String envVarName=null == m.group(1) ? m.group(2) : m.group(1);
    if (envVarName.startsWith(("env."))) {
      envVarValue=System.getenv(envVarName.substring(3));
    }
 else {
      envVarValue=System.getProperty(envVarName);
    }
    m.appendReplacement(sb,null == envVarValue ? "" : Matcher.quoteReplacement(envVarValue));
  }
  m.appendTail(sb);
  return sb.toString();
}

static String expandEnvironmentVariables ( String value ) { if ( null == value ) { return null ; } Matcher m = ENV_VAR_PATTERN . matcher ( value ) ; StringBuffer sb = new StringBuffer ( ) ; while ( m . find ( ) ) { String envVarValue = null ; String envVarName = null == m . group ( 1 ) ? m . group ( 2 ) : m . group ( 1 ) ; if ( envVarName . startsWith ( ( "env." ) ) ) { envVarValue = System . getenv ( envVarName . substring ( 3 ) ) ; } else { envVarValue = System . getProperty ( envVarName ) ; } m . appendReplacement ( sb , null == envVarValue ? "" : Matcher . quoteReplacement ( envVarValue ) ) ; } m . appendTail ( sb ) ; return sb . toString ( ) ; }
return the string value , expanding any environment variables found in the expression . < p > for example " home dir is $ { env . home } " will expand using the env var " home " to something like " home dir is / home / justin_bieber "
