code: public final String stringReplace(
          String toBeReplaced,
          String toReplace,
          String replacement
      ) {
          Pattern pattern = Pattern.compile(toReplace);
          Matcher match = pattern.matcher(toBeReplaced);
  
          while (match.find()) {
              toBeReplaced = match.replaceAll(replacement);
              match = pattern.matcher(toBeReplaced);
          }
  
          return toBeReplaced;
      }
docs: A replace string method
  
  @param toBeReplaced string to replace
  @param toReplace regex to match
  @param replacement string replacement for each match
  
  @return the replaced string