replace function

StreamTransformer<String, String> replace(
  1. String regexp,
  2. String replacement,
  3. {bool all = false,
  4. bool caseSensitive = true,
  5. bool unicode = false,
  6. bool dotAll = false}
)

Returns a transformer that replaces matches of regexp with replacement.

By default, only replaces the first match per line. If all is true, replaces all matches in each line instead.

The replacement may contain references to the capture groups in regexp, using a backslash followed by the group number. Backslashes not followed by a number return the character immediately following them.

The caseSensitive, unicode, and dotAll flags are the same as for new RegExp.

Implementation

StreamTransformer<String, String> replace(String regexp, String replacement,
        {bool all = false,
        bool caseSensitive = true,
        bool unicode = false,
        bool dotAll = false}) =>
    NamedStreamTransformer.fromBind(
        "replace",
        (stream) => stream.replace(regexp, replacement,
            all: all,
            caseSensitive: caseSensitive,
            unicode: unicode,
            dotAll: dotAll));