replaceMapped method
Replaces matches of regexp
with the result of calling replace
.
By default, only replaces the first match per line. If all
is true
,
replaces all matches in each line instead.
The caseSensitive
, unicode
, and dotAll
flags are the same as for
new RegExp
.
Implementation
Stream<String> replaceMapped(String regexp, String replace(Match match),
{bool all = false,
bool caseSensitive = true,
bool unicode = false,
bool dotAll = false}) {
var pattern = RegExp(regexp,
caseSensitive: caseSensitive, unicode: unicode, dotAll: dotAll);
return map((line) => all
? line.replaceAllMapped(pattern, replace)
: line.replaceFirstMapped(pattern, replace));
}