code: public String convertExtendedSmiles(String data){
  	  if(data != null){
  	  Pattern pattern = Pattern.compile("\\[\\*\\]|\\*");
  	  Matcher matcher = pattern.matcher(data);
  	  	if(matcher  != null){
  	  		String smiles = data.split("\\|")[0];
  	  		List<Integer> rgroupInformation = extractRgroups(data);
  	  		StringBuilder sb = new StringBuilder();
  	  		int start = 0;
  	  		int index = 0;
  	  		String rGroup = "";
  	  		while(matcher.find() && rgroupInformation.size() > 0){
  	  			rGroup = smiles.substring(start, matcher.end());
  	  			rGroup = rGroup.replace(matcher.group(),  "[*:"  +rgroupInformation.get(index) + "]");
  	  			sb.append(rGroup);
  	  			index ++;
  	  			start = matcher.end();
  	  		}
  	  		if( start < smiles.length()){
  	  			sb.append(smiles.substring(start));
  	  		}
  	  		return sb.toString();
  	  	}
  	  }
  	  return data;
    }
docs: convert extended smiles format to smiles with atom mappings
  
  @param data chemical notation to convert
  @return chemical notation