Dart API Referencedart:coreRegExp

RegExp Interface

RegExp represents regular expressions.

firstMatch is the main implementation method that applies a regular expression to a string and returns the first Match. All other methods in RegExp can build on it.

Use allMatches to look for all matches of a regular expression in a string.

The following example finds all matches of a regular expression in a string.

RegExp exp = const RegExp(@"(\w+)"); String str = "Parse my string"; Iterable<Match> matches = exp.allMatches(str);

Default class

JSSyntaxRegExp

Extends

Pattern

Implemented by

JSSyntaxRegExp

Constructors

Code const RegExp(String pattern, [bool multiLine, bool ignoreCase]) #

Constructs a regular expression. The default implementation of a RegExp sets multiLine and ignoreCase to false.

const RegExp(String pattern, [bool multiLine, bool ignoreCase]);

Methods

Code Iterable<Match> allMatches(String str) #

Returns an iterable on the matches of the regular expression in str.

Iterable<Match> allMatches(String str);

Code Match firstMatch(String str) #

Searches for the first match of the regular expression in the string str. Returns null if there is no match.

Match firstMatch(String str);

Code bool hasMatch(String str) #

Returns whether the regular expression has a match in the string str.

bool hasMatch(String str);

Code String stringMatch(String str) #

Searches for the first match of the regular expression in the string str and returns the matched string.

String stringMatch(String str);

Fields

Code final bool ignoreCase #

Whether this regular expression is case insensitive.

final bool ignoreCase;

Code final bool multiLine #

Whether this regular expression matches multiple lines.

final bool multiLine;

Code final String pattern #

The pattern of this regular expression.

final String pattern;