FluentRegex class

A Fluent interface to create readable regular expressions.

Implemented types

Constructors

FluentRegex([String? expression])

Properties

emailAddress FluentRegex
======================================================================== DEFAULT EXPRESSIONS
no setter
hashCode int
The hash code for this object.
no setterinherited
isCaseSensitive bool
Whether this regular expression is case sensitive.
no setteroverride
isDotAll bool
Whether "." in this regular expression matches line terminators.
no setteroverride
isMultiLine bool
Whether this regular expression matches multiple lines.
no setteroverride
isUnicode bool
Whether this regular expression uses Unicode mode.
no setteroverride
pattern String
The regular expression pattern source of this RegExp.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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
hasMatch(String input) bool
======================================================================== REGEXP METHOD OVERRIDES
override
hasNoMatch(String input) bool
======================================================================== CONVENIENCE METHODS
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
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 nonexistent 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?
Finds the string of the first match of this regular expression in input.
override
tab([Quantity quantity = const Quantity.oneTime()]) FluentRegex
======================================================================== WHITE SPACE CHARACTERS
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

Operators

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

Static Methods

escape(String value) String
======================================================================== CONVERSION METHODS
override