tidyreplace
Extended native string replace method
replace(str, substr, newSubstr, data)
str
- string to perform the replace
substring
- match with string or regex
newSubstr
- replacement string or function returning a string
data
- object or array of objects to merge with arguments that
are made available to the newSubstr function
properties generally available to newSubstr function:
- string (original string)
- match (matched substring)
- submatch (array of capturing groups matches)
- offset (offset of the matched substring within the original string)
var replace = ; //"hello world" //"hello world" ;//"hello world", ;//"hello world" str = ;//"hello world"