Replace full request content.

@param requestContentTemplate
the request content template
@param replacementString
the replacement string
@return the string
165392
public static String replaceFullRequestContent(
            String requestContentTemplate, String replacementString) {
        return (requestContentTemplate.replace(
                PcConstants.COMMAND_VAR_DEFAULT_REQUEST_CONTENT,
                replacementString));
    }
1375006
public String replace(String str, String regex, String replace) {
		if (str == null)
			return "";
		if (regex == null)
			return str;
		if(replace == null) replace = "";
		return str.replaceAll(regex, replace);
	}
589832
protected static String getSubstitutedTemplateContent(String templateContent, NamesValuesList<String, String> namesValues) {
        String templateContentSubst = templateContent;
        // substitute the name/values

        for (NameValue<String, String> nameValue : namesValues) {
            templateContentSubst = templateContentSubst.replace(nameValue.name, nameValue.value);
        }
        return templateContentSubst;
    }
633285
public static String replaceAllEmojis(String str, final String replacementString) {
    EmojiParser.EmojiTransformer emojiTransformer = new EmojiParser.EmojiTransformer() {
      public String transform(EmojiParser.UnicodeCandidate unicodeCandidate) {
        return replacementString;
      }
    };

    return parseFromUnicode(str, emojiTransformer);
  }
939497
function replaceAt(content, index, oldString, newString) {
  logger.debug(`Replacing ${oldString} with ${newString} at index ${index}`);
  return (
    content.substr(0, index) +
    newString +
    content.substr(index + oldString.length)
  );
}
36760
public Tuple3<ReadOnlyStyledDocument<PS, SEG, S>, RichTextChange<PS, SEG, S>, MaterializedListModification<Paragraph<PS, SEG, S>>> replace(
            Replacement<PS, SEG, S> replacement) {
        return replace(replacement.getStart(), replacement.getEnd(), replacement.getDocument());
    }
829805
public static Filter replaceInBuffer(final String regexp, final String replacement) {
        return replaceInBuffer(Pattern.compile(regexp), replacement);
    }
625246
private byte[] replaceInXml(CmsFile cmsFile) throws Exception {

        Exception e = null;
        CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), cmsFile);
        Pattern pattern = Pattern.compile(m_settings.getSearchpattern());
        // loop over the locales of the content
        boolean modified = false;
        boolean matched = false;
        String requestedLocale = m_settings.getLocale();
        for (Locale locale : xmlContent.getLocales()) {
            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(requestedLocale)
                && !locale.toString().equalsIgnoreCase(requestedLocale)) {
                // does not match the requested locale, skip it
                continue;
            }
            // loop over the available element paths of the current content locale
            List<String> paths = xmlContent.getNames(locale);
            for (String xpath : paths) {
                // try to get the value extraction for the current element path
                I_CmsXmlContentValue value = xmlContent.getValue(xpath, locale);
                if (value.isSimpleType()) {
                    try {
                        String currPath = value.getPath();
                        if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_settings.getXpath())
                            || currPath.equals(m_settings.getXpath())
                            || (CmsXmlUtils.removeXpath(currPath).equals(m_settings.getXpath()))) {
                            // xpath match
                            String oldVal = value.getStringValue(getCms());
                            Matcher matcher = pattern.matcher(oldVal);
                            matcher = Pattern.compile(m_settings.getSearchpattern()).matcher(oldVal);
                            if (matcher.find()) {
                                matched = true;
                                m_matchedResources.add(cmsFile);
                                if (m_replace) {
                                    String newVal = matcher.replaceAll(m_settings.getReplacepattern());
                                    if (!oldVal.equals(newVal)) {
                                        value.setStringValue(getCms(), newVal);
                                        modified = true;
                                    }
                                }
                            }
                        }
                    } catch (Exception ex) {
                        // log and go on
                        LOG.error(ex.getMessage(), ex);
                        e = ex;
                    }
                }
            }
        }
        if (e != null) {
            throw e;
        }
        if (matched) {
            getReport().println(Messages.get().container(Messages.RPT_SOURCESEARCH_MATCHED_0), I_CmsReport.FORMAT_OK);
        } else {
            getReport().println(
                Messages.get().container(Messages.RPT_SOURCESEARCH_NOT_MATCHED_0),
                I_CmsReport.FORMAT_NOTE);
        }
        if (modified) {
            return xmlContent.marshal();
        }
        return null;
    }
995303
private String transformContent(String content) {

        try {
            List<CmsJsonPart> parts = CmsJsonPart.parseJsonParts(content);
            JSONArray keys = new JSONArray();
            JSONObject output = new JSONObject();
            for (CmsJsonPart part : parts) {
                if (output.has(part.getKey())) {
                    LOG.warn("Duplicate key for JSON parts: " + part.getKey());
                }
                keys.put(part.getKey());
                output.put(part.getKey(), part.getValue());
            }
            output.put(KEY_PARTS, keys);
            return output.toString();
        } catch (Exception e) {
            LOG.error(e.getLocalizedMessage(), e);
            return content;

        }
    }
164498
public static URI replaceScheme(URI uri, String replace, String replacement) {
    if (replace != null && replace.equals(replacement)) {
      return uri;
    }
    try {
      if (replace != null && replace.equals(uri.getScheme())) {
        return new URI(replacement, uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(), uri.getQuery(), uri.getFragment());
      } else {
        return uri;
      }
    } catch (URISyntaxException use) {
      throw new RuntimeException("Failed to replace scheme.");
    }
  }
975567
function replaceBlocks(content, blocks) {
    var newContent = content.replace(/\{\{\-\%([\s\S]+?)\%\-\}\}/g, function(match, key) {
        var replacedWith = match;

        var block = blocks.get(key);
        if (block) {
            replacedWith = replaceBlocks(block.get('body'), blocks);
        }

        return replacedWith;
    });

    return newContent;
}
671505
public static void replaceContent(final JComponent container, final JComponent content,
		boolean scrollable)
	{
		container.removeAll();
		if (scrollable)
		{
			container.add(new JScrollPane(content));
		}
		else
		{
			container.add(content);
		}
		container.revalidate();
		replaceContentInMultiSplitPane(container, content, scrollable);
	}
583565
public static String addCharset(String charset, String contentType)
    {
        if (null == contentType)
        {
            return "text/plain;charset=" + charset;
        }
        else
        {
            Matcher matcher = CHARSET_PATT.matcher(contentType);
            if (matcher.find())
            {
                // replace what ever content-type with the charset
                return contentType.substring(0, matcher.start(1)) +
                    charset + contentType.substring(matcher.end(1));
            }
            else
            {
                return contentType + ";charset=" + charset;
            }
        }
    }
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;
  }
806486
@Override
	protected boolean copyRequestedContentToResponse(String requestedPath, HttpServletResponse response,
			String contentType) throws IOException {

		boolean copyDone = false;
		if (isValidRequestedPath(requestedPath)) {

			try {
				writeContent(requestedPath, null, response);
				response.setContentType(contentType);
				copyDone = true;
			} catch (ResourceNotFoundException e) {
				// Nothing to do here
			}
		}

		return copyDone;
	}
323163
private String replacementFor(String cn) {
        String name = cn;
        String value = null;
        while (value == null && name != null) {
            try {
                value = ResourceBundleHelper.jdkinternals.getString(name);
            } catch (MissingResourceException e) {
                // go up one subpackage level
                int i = name.lastIndexOf('.');
                name = i > 0 ? name.substring(0, i) : null;
            }
        }
        return value;
    }
746160
protected function getQueryFromRequest(RequestInterface $request, $replacement = '-'): string
    {
        $query = urldecode($request->getUri()->getQuery());
        $parts = explode('&', $query);
        sort($parts);
        $query = implode('&', $parts);

        return (string)Stringy::create(str_replace(['\\', '/', '?', ':', '*', '"', '>', '<', '|'], $replacement, $query))
            ->toAscii()
            ->delimit($replacement)
            ->removeLeft($replacement)
            ->removeRight($replacement);
    }