Dart Regular Expressions
Syntax
• var regExp = RegExp(r'^(.*)$', multiLine: true, caseSensitive: false);
Parameters
Parameter | Details |
String source | The regular expression as a String |
{bool multiline} | Whether this is a multiline regular expression. (matches ^ and $ at thebeginning and end of each line individually not the whole String) |
{boolcaseSensitive} | If the expression is case sensitive |
Examples
Create and use a Regular Expression
var regExp = new RegExp(r"(\w+)");
var str = "Parse my string";
Iterable<Match> matches = regExp.allMatches(str);
It's a good idea to use "raw strings" (prefix with r) when writing regular expressions so you can use unescaped backslashes in your expression.