Function replaceAll( str, regex, replacement )
- Description:
-
Replaces all occurrences of a regular expression in a string with
a different substring value.
- Parameters:
-
- str (String)
- string to manipulate
- regex (String)
- regular expression to match in
str
- replacement (String)
- replacement string
- Return Value (String):
- same as
str
, but with all matches of
regex
replaced by replacement
- Example:
replaceAll("1-2--3---4","--*","x") = "1x2x3x4"
- Signature:
- String replaceAll(String, String, String)