code: public String replace(String str, String replacement) {
                  if (isGlobal) {
                          return getMatcher(str).replaceAll(replacement);
                  } else {
                          return getMatcher(str).replaceFirst(replacement);
                  }
          }
docs: replace the found substring with replacement<br>
  for global regex, invoke {@link Matcher#replaceAll(String)}<br>
  others, invoke {@link Matcher#replaceFirst(String)}
  
  @param str         the string to be replaced
  @param replacement the string to replace
  @return result string
  @see Matcher#replaceAll(String)
  @see Matcher#replaceFirst(String)