public native replace(input as String, replacement as String) as String throws RegExException
Replaces all occurrences of the pattern with a replacement string. $1, $2, etc. expand captured groups; $& expands the complete match.
| Parameter | Description |
|---|---|
input | The string where the replacement will be performed. |
replacement | The replacement string. |
The string after the replacement.
regex = RegEx(r"\d+")
result = regex.replace("123 abc 456", "#") # result will be "# abc #"