This method replaces each substring of the subject string that matches the given regular expression with the replacement String. As the name implies, replaceAll replaces all the matching occurrences of the input String. Note that we can also supply a simple String containing no regex meta character in the first argument.
Calling this method is equivalent to a call to the following:
The replacement string allows the use of references to substrings, represented by the captured groups ...