CharacterSet class
a CharacterSet is a collection of characters that is being searched for. e.g. it may contain letters and/or digits and/or other literals. You can also add a range e.g.:
- 'k-p' (letters k trough p)
- '2-6' (digits 2 trough 6)
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addDigits(
) → CharacterSet - See SpecialCharacter.digit Example: var regex=FluentRegex().characterSet(CharacterSet().addDigits()); expect(regex.hasMatch('1'),true); expect(regex.hasMatch('a'),false);
-
addLetters(
[CaseType caseType = CaseType.lowerAndUpper]) → CharacterSet - Example: var regex = FluentRegex().characterSet(CharacterSet().addLetters()); expect(regex.hasMatch('a'), true); expect(regex.hasMatch('B'), true); expect(regex.hasMatch('3'), false);
-
addLineBreaks(
) → CharacterSet - See SpecialCharacter.carriageReturn and SpecialCharacter.lineFeed Example: expect(regex.findFirst('hello\rworld'), '\r'); expect(regex.findFirst('hello\nworld'), '\n'); expect(regex.findFirst('hello\r\nworld'), '\r\n'); expect(regex.findFirst('hello\r\rworld'), '\r\r'); expect(regex.hasMatch('hello world'), false);
-
addLiterals(
String literalsToAdd) → CharacterSet - Example: var regex = FluentRegex().characterSet(CharacterSet().addLiterals('-')); expect(regex.hasMatch('-'), true); expect(regex.hasMatch(''), true); expect(regex.hasMatch('a'), false);
-
addNoneDigits(
) → CharacterSet - See SpecialCharacter.noneDigit Example: var regex=FluentRegex().characterSet(CharacterSet().addDigits()); expect(regex.hasMatch('1'),false); expect(regex.hasMatch('a'),true);
-
addNoneWhiteSpaces(
) → CharacterSet - See SpecialCharacter.noneWhiteSpace Example: var regex = FluentRegex().characterSet(CharacterSet().addNoneWhiteSpaces()); expect(regex.hasMatch(' '), false); expect(regex.hasMatch('\u0009'), false); expect(regex.hasMatch('\n'), false); expect(regex.hasMatch('\x0B'), false); expect(regex.hasMatch('\f'), false); expect(regex.hasMatch('\r'), false); expect(regex.hasMatch('h'), true);
-
addNoneWordChars(
) → CharacterSet - See SpecialCharacter.noneWordChar Example: var regex=FluentRegex().characterSet(CharacterSet().addNoneWordCharacters()); expect(regex.hasMatch('a'),false); expect(regex.hasMatch('Z'),false); expect(regex.hasMatch('1'),false); expect(regex.hasMatch('!'),true);
-
addRange(
String from, String to) → CharacterSet - Example: var regex = FluentRegex() .characterSet(CharacterSet().addRange('k', 'p').addRange('2', '6')); expect(regex.hasMatch('l'), true); expect(regex.hasMatch('5'), true); expect(regex.hasMatch('a'), false);
-
addTabs(
) → CharacterSet - See SpecialCharacter.tab Example: var regex = FluentRegex().characterSet(CharacterSet().tab()); expect(regex.hasMatch('hello'), false); expect(regex.hasMatch('\u0009hello'), true); expect(regex.hasMatch('hello\tall'), true);
-
addWhiteSpaces(
) → CharacterSet - See SpecialCharacter.whiteSpace Example: var regex = FluentRegex().characterSet(CharacterSet().addWhiteSpaces()); expect(regex.hasMatch(' '), true); expect(regex.hasMatch('\u0009'), true); expect(regex.hasMatch('\n'), true); expect(regex.hasMatch('\x0B'), true); expect(regex.hasMatch('\f'), true); expect(regex.hasMatch('\r'), true); expect(regex.hasMatch('h'), false);
-
addWordChars(
) → CharacterSet - See SpecialCharacter.wordChar Example: var regex=FluentRegex().characterSet(CharacterSet().addWordCharacters()); expect(regex.hasMatch('a'),true); expect(regex.hasMatch('Z'),true); expect(regex.hasMatch('1'),true); expect(regex.hasMatch('!'),false);
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited