- pattern is the regular expression to use
- replacement is used to replace any match of the pattern
This function first resets the matcher pattern. It then scans the input sequence looking for matches of the pattern. Characters that are not part of any match are appended directly to the result string with each match replaced by the replacement string. Captured groups can be used in the replacement string via $0, $1, etc.
For example:Will result in the following being printed: