RegExpExtensions extension

Shortcuts for the most common RegExp jobs.

final number = RegExp(r'\d+');
number.find('order 66 of 99');    // '66'
number.findAll('order 66 of 99'); // ['66', '99']
number.matchesWhole('123');       // true
number.matchesWhole('123abc');    // false
on

Methods

countIn(String input) → int

Available on RegExp, provided by the RegExpExtensions extension

How many times this matches in input.
find(String input) → String?

Available on RegExp, provided by the RegExpExtensions extension

The first matching text in input, or null if nothing matches.
findAll(String input) → List<String>

Available on RegExp, provided by the RegExpExtensions extension

Every matching text in input.
matchesWhole(String input) → bool

Available on RegExp, provided by the RegExpExtensions extension

Whether the whole of input matches, not just part of it.