RegexTransformer class
A RegExp paired with an output template that matches input text with the RegExp and returns a new string based on the template with the capture groups matched by the RegExp filled in.
Constructors
-
RegexTransformer({required RegExp regex, required String output, Map<
String, dynamic> ? variables, bool math = false, bool strict = false}) - A RegExp paired with an output template that matches input text with the RegExp and returns a new string based on the template with the capture groups matched by the RegExp filled in.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- math → bool
-
If
true, will map every constant and function from thedart:mathlibrary to the expression evaluator's context, allowing them to be parsed and evaluated within any expressions included in the output template.final - output → String
-
The template for the text output by transform.
final
- regex → RegExp
-
The RegExp used to match any text provided to transform.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- strict → bool
-
If
true, a FormatException will be thrown if any capture groups defined in output weren't matched in text provided to transform or if they weren't included in regex. Iffalse, any unmatched capture groups will be treated as plain text.final -
variables
→ Map<
String, dynamic> ? -
The variables and functions mapped to the
Expressionevaluator's context.final
Methods
-
copyWith(
{RegExp? regex, String? output, Map< String, dynamic> ? variables, bool? math, bool? strict}) → RegexTransformer -
Returns a copy of
thisupdated with the provided values. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
transform(
String input) → String -
Identifies the first match of regex in
inputand outputs new String as defined by the output template. -
transformAll(
String input) → String -
Replaces every instance of regex within
inputwith new text as defined by the output template.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited