RegExp constructor
Constructs a regular expression.
Throws a FormatException if source
is not valid regular
expression syntax.
If multiLine
is enabled, then ^
and $
will match the beginning and
end of a line, in addition to matching beginning and end of input,
respectively.
If caseSensitive
is disabled, then case is ignored.
Example:
var wordPattern = RegExp(r"(\w+)");
var bracketedNumberValue = RegExp("$key: \\[\\d+\\]");
Notice the use of a raw string in the first example, and a regular string in the second. Because of the many character classes used in regular expressions, it is common to use a raw string here, unless string interpolation is required.
Implementation
external factory RegExp(String source,
{bool multiLine: false, bool caseSensitive: true});