Creates a new String with some or all of the matches of a pattern replaced by a replacement.
The pattern to be matched is specified by the 'pattern' parameter.
The replacement to be set is specified by the 'replacement' parameter.
An optional 'flags' parameter can be set.
Usage
expression | replace:pattern:replacement
All behavior is based on the expected behavior of the JavaScript API String.prototype.replace() function.
Where the input expression is a String
or Number
(to be treated as a
string),
the pattern
is a String
or RegExp
,
the 'replacement' is a String
or Function
.
--Note--: The 'pattern' parameter will be converted to a RegExp instance. Make sure to escape the string properly if you are matching for regular expression special characters like parenthesis, brackets etc.
- Implements
-
- PipeTransform
- Annotations
- Pipe(name: "replace")
- Injectable()
Constructors
Properties
- hashCode → int
-
Get a hash code for this object.
read-only, inherited - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Operators
-
operator ==(
other) → bool -
The equality operator.
inherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited -
toString(
) → String -
Returns a string representation of this object.
inherited -
transform(
value, pattern, replacement) → dynamic