Package snap.parse
Class RegexBuilder
java.lang.Object
snap.parse.RegexBuilder
A class for building regular expressions like a string buffer.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds any char (doesn't include newlines).addChar
(char c) Adds a literal char.void
Adds a letter.addDigit()
Adds a digit: [0-9].void
addGroup
(RegexBuilder.Op anOp, String... theParts) Adds a group.Adds any letter.Adds any letter.Adds any letter.Adds a non-digit: [^0-9].Adds non-whitespace char: [^\s].Adds a non-word character: [^\w].Adds whitespace char [ \t\n\x0B\f\r].Adds a word character: [a-zA-Z_0-9].build()
Builds and returns a regex.Returns the regex pattern.
-
Field Details
-
LetterLower
- See Also:
-
LetterUpper
- See Also:
-
Digit
- See Also:
-
WhiteSpace
- See Also:
-
-
Constructor Details
-
RegexBuilder
Constructor with given pattern and name.
-
-
Method Details
-
build
Builds and returns a regex. -
getPattern
Returns the regex pattern. -
addGroup
Adds a group. -
addChars
Adds a letter. -
addChar
Adds a literal char. -
addLetter
Adds any letter. -
addLetterLower
Adds any letter. -
addLetterUpper
Adds any letter. -
addAnyChar
Adds any char (doesn't include newlines). -
addDigit
Adds a digit: [0-9]. -
addNonDigit
Adds a non-digit: [^0-9]. -
addWhitespace
Adds whitespace char [ \t\n\x0B\f\r]. -
addNonWhitespace
Adds non-whitespace char: [^\s]. -
addWordCharacter
Adds a word character: [a-zA-Z_0-9]. -
addNonWordCharacter
Adds a non-word character: [^\w].
-