Replace the {} resources in this string.
@param reg
@param map A map of key/values
@param strResource
@return
775727
public static String replaceResources(String string, ResourceBundle reg, Map<String, Object> map, PropertyOwner propertyOwner, boolean systemProperties)
    {
        if (string != null)
            if (string.indexOf('{') == -1)
                return string;
        return Utility.replaceResources(new StringBuilder(string), reg, map, propertyOwner, systemProperties).toString();
    }
514705
Object replaceObject(ResourceRefConfigFactory resRefConfigFactory) {
        DSConfig config = dsConfig.get();
        String filter = config.jndiName == null || config.jndiName.startsWith("java:")
                        ? FilterUtils.createPropertyFilter("config.displayId", config.id)
                        : FilterUtils.createPropertyFilter(ResourceFactory.JNDI_NAME, config.jndiName);
        ResourceRefConfig resRefConfig = resRefInfo == null ? null : resRefConfigFactory.createResourceRefConfig(DataSource.class.getName());
        if (resRefInfo != null) {
            resRefConfig.setBranchCoupling(resRefInfo.getBranchCoupling());
            resRefConfig.setCommitPriority(resRefInfo.getCommitPriority());
            resRefConfig.setIsolationLevel(resRefInfo.getIsolationLevel());
            resRefConfig.setJNDIName(resRefInfo.getJNDIName());
            resRefConfig.setLoginConfigurationName(resRefInfo.getLoginConfigurationName());
            resRefConfig.setResAuthType(resRefInfo.getAuth());
            resRefConfig.setSharingScope(resRefInfo.getSharingScope());
        }
        return new SerializedDataSourceWrapper(filter, resRefConfig);
    }
157097
private static synchronized Map<String, String> getReverseNucleotideTemplateMap(
      String notationSource) {
    Map<String, String> map = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
    Map<String, String> normalMap = nucleotideTemplates.get(notationSource);
    if (normalMap != null) {
      Set<String> set = normalMap.keySet();
      for (Iterator i = set.iterator(); i.hasNext();) {
        String tmp = (String) i.next();
        map.put(normalMap.get(tmp), tmp);
      }
    }
    return map;
  }
1065145
public static String replace(String str, String search, String replace) {
        if (str == null || search == null || replace == null) {
            return str;
        }
        StringBuilder sb = new StringBuilder();
        int searchLen = search.length();
        int stringLen = str.length();
        int oldIndex = 0;
        int index;
        while ((index = str.indexOf(search, oldIndex)) >= 0) {
            sb.append(str, oldIndex, index);
            sb.append(replace);
            oldIndex = index + searchLen;
        }
        if (oldIndex < stringLen) {
            sb.append(str, oldIndex, stringLen);
        }
        return sb.toString();
    }
832163
public Map<String, Map<String, String>> getMBeanAttributesByRegex(String regex) throws Exception {
        Map<String, Map<String, String>> result = Maps.newLinkedHashMap();
        ObjectName name = new ObjectName(regex);
        Set<ObjectName> objs = mBeanServer.queryNames(name, null);
        
        // Convert object naems to a tree
        for (ObjectName objName : objs) {
            result.put(objName.getCanonicalName(), getMBeanAttributes(objName));
        }

        return result;
    }
1238287
public PactDslRequestWithPath matchQuery(String parameter, String regex) {
        return matchQuery(parameter, regex, new Generex(regex).random());
    }
118736
public static String replaceFirst(String source, String find, String replace) {
    return fastReplaceFirst(source, find, replace);
  }
1158448
function(s) {
    try {
        const re = new RegExp(s);
        return re.source;
    } catch (ex) {
        normalizeRegexSource.message = ex.toString();
    }
    return '';
}
301395
public static String replaceHtmlEntities(String content, Map<String, Character> map) {
    
    for (Entry<String, Character> entry : escapeStrings.entrySet()) {
      
      if (content.indexOf(entry.getKey()) != -1) {
        content = content.replace(entry.getKey(), String.valueOf(entry.getValue()));
      }
      
    }
    
    return content;
  }
1235421
@SuppressWarnings("rawtypes")
	public String replace(String source,char replaceChar)
	{
		StringBuilder sb = new StringBuilder(source);
		char[] chars = source.toCharArray();
		int start = -1, end = -1;
		Map nowMap = pool;
		for (int i = 0; i < chars.length; i++)
		{
			char ch = Character.toUpperCase(chars[i]);
			nowMap = (Map) nowMap.get(ch);
			if (nowMap != null)
			{
				if (start == -1)
				{
					start = i;
				}
				if ("1".equals(nowMap.get("isEnd")))
				{
					end = i;
					for (int j = start; j <= end; j++)
					{
						sb.setCharAt(j, replaceChar);
					}
					start = -1; end = -1;
				}
			}
			else
			{
				start = -1;
				nowMap = pool;
				nowMap = (Map) nowMap.get(ch);
				if (nowMap != null)
				{
					if (start == -1)
					{
						start = i;
					}
					if ("1".equals(nowMap.get("isEnd")))
					{
						end = i;
						for (int j = start; j <= end; j++)
						{
							sb.setCharAt(j, replaceChar);
						}
						start = -1; end = -1;
					}
				}
				else
				{
					nowMap = pool;
				}
			}
		}
		return sb.toString();
	}
598167
public void replaceMapChildren(Map<String, String> map, String parentId) {
		ArrayList<StringEntity> entities = new ArrayList<>();
		for (String key : map.keySet()) {
			StringEntity entity = new StringEntity();
			entity.setParentId(parentId);
			entity.setId(key);
			entity.setValue(map.get(key));
			entities.add(entity);
		}
		replaceChildren(entities, parentId);
	}
710237
private String replaceProperties(String message, Map<String, String> map) {
        if (map != null) {
            for (Entry<String, String> entr : map.entrySet()) {
                message = StringUtils.replace(message, "@{" + entr.getKey() + "}", entr.getValue());
            }
        }
        return message;
    }
217090
@SneakyThrows
   public static String dumps(@NonNull Map<String, ?> map) {
      Resource strResource = new StringResource();
      try (JsonWriter writer = new JsonWriter(strResource)) {
         writer.beginDocument();
         for (Map.Entry<String, ?> entry : map.entrySet()) {
            writer.property(entry.getKey(), entry.getValue());
         }
         writer.endDocument();
      }
      return strResource.readToString().trim();
   }
175930
function replaceStringInAsset(asset, source, target) {
    const sourceRE = new RegExp(source, 'g');

    if (typeof asset === 'string') {
        return asset.replace(sourceRE, target);
    }

    // ReplaceSource
    if ('_source' in asset) {
        asset._source = replaceStringInAsset(asset._source, source, target);
        return asset;
    }

    // CachedSource
    if ('_cachedSource' in asset) {
        asset._cachedSource = asset.source().replace(sourceRE, target);
        return asset;
    }

    // RawSource / SourceMapSource
    if ('_value' in asset) {
        asset._value = asset.source().replace(sourceRE, target);
        return asset;
    }

    // ConcatSource
    if ('children' in asset) {
        asset.children = asset.children.map(child => replaceStringInAsset(child, source, target));
        return asset;
    }

    throw new Error(
        `Unknown asset type (${asset.constructor.name})!. ` +
            'Unfortunately this type of asset is not supported yet. ' +
            'Please raise an issue and we will look into it asap'
    );
}
832840
private static Pattern replacePlaceHolders(String s) {
    s = Pattern.quote(s);
    return Pattern.compile(s.replaceAll("\\{\\d+\\}", "\\\\E.*\\\\Q"));
  }
1178169
private static InputSource stringToSource(String str) {
        InputSource is = new InputSource(new StringReader(str));
        is.setEncoding("UTF-8");
        return is;
    }
1268651
function regex(replacements) {
    return {
        name: 'regex',

        renderChunk(code) {
            const magicString = new MagicString(code);
            let hasReplacements = false;

            replacements.forEach(replacement => {
                let [find, replace = ''] = replacement;
                if (typeof find === 'string') find = new RegExp(find);
                if (!find.global) find = new RegExp(find.source, 'g' + String(find).split('/').pop());

                let match, start, end;
                while ((match = find.exec(code))) {
                    hasReplacements = true;

                    start = match.index;
                    end = start + match[0].length;

                    magicString.overwrite(start, end, typeof replace === 'function' ? replace.apply(null, match) || '' : replace.replace(/\$(\d+)/, (str, index) => match[index]));
                }
            });

            if (!hasReplacements) return null;

            return {
                code: magicString.toString(),
                map: magicString.generateMap({ hires: true })
            };
        }
    };
}