)
Replaces all substrings that match from
with replace
.
Returns a new string in which the non-overlapping substrings matching
from
(the ones iterated by from.allMatches(thisString)
) are replaced
by the literal string replace
.
'resume'.replaceAll(new RegExp(r'e'), 'é'); // 'résumé'
Notice that the replace
string is not interpreted. If the replacement
depends on the match (for example on a RegExp's capture groups), use
the replaceAllMapped method instead.
Source
/**
* Replaces all substrings that match [from] with [replace].
*
* Returns a new string in which the non-overlapping substrings matching
* [from] (the ones iterated by `from.allMatches(thisString)`) are replaced
* by the literal string [replace].
*
* 'resume'.replaceAll(new RegExp(r'e'), 'é'); // 'résumé'
*
* Notice that the [replace] string is not interpreted. If the replacement
* depends on the match (for example on a [RegExp]'s capture groups), use
* the [replaceAllMapped] method instead.
*/
String replaceAll(Pattern from, String replace);