code: public static String updateProperties( String propertiesContent, Map<String,String> keyToNewValue ) {
  
  		for( Map.Entry<String,String> entry : keyToNewValue.entrySet()) {
  			propertiesContent = propertiesContent.replaceFirst(
  					"(?mi)^\\s*" + entry.getKey() + "\\s*[:=][^\n]*$",
  					entry.getKey() + " = " + entry.getValue());
  		}
  
  		return propertiesContent;
  	}
docs: Updates string properties.
  @param propertiesContent the properties file as a string
  @param keyToNewValue the keys to update with their new values
  @return a non-null string