FluentRegex class Null safety

A Fluent interface to create readable regular expressions.

Implemented types

Constructors

FluentRegex([String? expression])

Properties

emailAddress FluentRegex
======================================================================== DEFAULT EXPRESSIONS ========================================================================
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
isCaseSensitive bool
Whether this regular expression is case sensitive. [...]
read-only, override
isDotAll bool
Whether "." in this regular expression matches line terminators. [...]
read-only, override
isMultiLine bool
Whether this regular expression matches multiple lines. [...]
read-only, override
isUnicode bool
Whether this regular expression is in Unicode mode. [...]
read-only, override
pattern String
The source regular expression string used to create this RegExp.
read-only, override
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

allMatches(String input, [int start = 0]) Iterable<RegExpMatch>
Matches this pattern against the string repeatedly. [...]
override
anyCharacter([Quantity quantity = const Quantity.oneTime()]) FluentRegex
appends any character [...]
characterSet(CharacterSet characterSet, [Quantity quantity = const Quantity.oneTime()]) FluentRegex
Appends a CharacterSet to search for in the next character. [...]
digit([Quantity quantity = const Quantity.oneTime()]) FluentRegex
Appends digit, same as 0-9 [...]
endOfLine([bool enable = true]) FluentRegex
Mark the expression to end at the last character of the line [...]
findAll(String source, [int start = 0]) List<String>
Example: expect(FluentRegex().digit().findAll('a1bc2D3e&(f4'), '1', '2', '3', '4'); expect(FluentRegex().letter().findAll('123&(4'), []);
findCapturedGroups(String source, [int start = 0]) Map<String, String?>
Example: expect( FluentRegex() .group(FluentRegex().literal('a').digit().literal('b'), type: GroupType.captureNamed('name')) .findCapturedGroups('@abc2a7bD3e&(f4'), { 'name': 'a7b', });
findFirst(String source) String?
Example: expect(FluentRegex().literal('a').findFirst('bababa'), 'a'); expect(FluentRegex().literal('c').findFirst('bababa'), null);
firstMatch(String input) RegExpMatch?
Finds the first match of the regular expression in the string input. [...]
override
group(FluentRegex fluentRegex, {GroupType type = const GroupType.noneCapturing(), Quantity quantity = const Quantity.oneTime()}) FluentRegex
======================================================================== GROUP ======================================================================== Appends a fluentRegex as a group [...]
hasMatch(String input) bool
======================================================================== REGEXP METHOD OVERRIDES ========================================================================
override
hasNoMatch(String input) bool
======================================================================== CONVENIENCE METHODS ======================================================================== Example: expect(FluentRegex().digit().hasNoMatch('a'), true); expect(FluentRegex().letter().hasNoMatch('a'), false);
ignoreCase([bool enable = true]) FluentRegex
Enable or disable matching with ignoring case according to enable flag. [...]
letter({CaseType caseType = CaseType.lowerAndUpper, Quantity quantity = const Quantity.oneTime()}) FluentRegex
Example: var regex = FluentRegex().letter(); expect(regex.hasMatch('l'), true); expect(regex.hasMatch('W'), true); expect(regex.hasMatch('5'), false); expect(regex.hasMatch('_'), false); expect(regex.hasMatch('%'), false);
lineBreak([Quantity quantity = const Quantity.oneTime()]) FluentRegex
Appends universal (Unix + Windows CRLF + Macintosh) line break expression [...]
literal(String literal, [Quantity quantity = const Quantity.oneTime()]) FluentRegex
======================================================================== LITERALS ======================================================================== Appends an expression to find the literal expression [...]
matchAsPrefix(String string, [int start = 0]) Match?
Matches this pattern against the start of string. [...]
override
multiline([bool enable = true]) FluentRegex
======================================================================== CONSTRUCTORS [...]
nonDigit([Quantity quantity = const Quantity.oneTime()]) FluentRegex
Appends non-digit, same as ^0-9 [...]
nonLetter({CaseType caseType = CaseType.lowerAndUpper, Quantity quantity = const Quantity.oneTime()}) FluentRegex
Example: var regex = FluentRegex().nonLetter(); expect(regex.hasMatch('5'), true); expect(regex.hasMatch('_'), true); expect(regex.hasMatch('%'), true); expect(regex.hasMatch('l'), false); expect(regex.hasMatch('W'), false);
nonWhiteSpace([Quantity quantity = const Quantity.oneTime()]) FluentRegex
Appends non-whitespace character, same as ^\s [...]
nonWordChar([Quantity quantity = const Quantity.oneTime()]) FluentRegex
Appends non-letters or digits, same as ^\w [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
or(List<FluentRegex> fluentRegExpressions, [Quantity quantity = const Quantity.oneTime()]) FluentRegex
Appends multiple FluentRegexpressions as an or group [...]
removeAll(String source) String
Example: expect(FluentRegex().literal('a').removeAll('bababa'), 'bbb');
removeFirst(String source) String
Example: expect(FluentRegex().literal('a').removeFirst('bababa'), 'bbaba');
replaceAll(String source, String replacement) String
Example: expect(FluentRegex().literal('a').replaceAll('bababa', 'c'), 'bcbcbc');
replaceFirst(String source, String replacement) String
Example: expect(FluentRegex().literal('a').replaceFirst('bababa', 'c'), 'bcbaba');
searchFirstLineOnly([bool enable = true]) FluentRegex
Enable or disable search in one line in prior to multi line search according to enable flag. [...]
startOfLine([bool enable = true]) FluentRegex
Mark the expression to start at the beginning of the line [...]
stringMatch(String input) String?
The substring of the first match of this regular expression in input.
override
tab([Quantity quantity = const Quantity.oneTime()]) FluentRegex
======================================================================== WHITE SPACE CHARACTERS ======================================================================== Appends expression to match a tab character ('\u0009') [...]
toString() String
Overrides toString Returns resulting RegExp pattern
override
whiteSpace([Quantity quantity = const Quantity.oneTime()]) FluentRegex
Appends whitespace character, same as \t\n\x0B\f\r [...]
wordChar([Quantity quantity = const Quantity.oneTime()]) FluentRegex
======================================================================== SPECIAL CHARACTERS ======================================================================== Appends letters or digits, same as a-zA-Z_0-9 [...]

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited

Static Methods

escape(String value) String
======================================================================== CONVERSION METHODS ======================================================================== Escapes (adds two slashes before) characters that have a special meaning in a RegExp: characters to escape are: ^$.|?*+()[]{} [...]
override