Class Regex
java.lang.Object
com.inductiveautomation.snap.parse.Regex
A class for building regular expressions like a string buffer.
- 
Nested Class SummaryNested Classes
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionAdds any char (doesn't include newlines).addChar(char c) Adds a literal char.voidAdds a letter.addDigit()Adds a digit: [0-9].voidAdds 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].charReturns the first literal in regex pattern (or 0 if not literal).static chargetLiteralChar(String aPattern) Returns the first char of a pattern, if it's a literal char.intReturns the literal length of this regex (the number of literal chars in the prefix).static intgetLiteralLength(String aPattern) Returns the literal length of pattern.getMatcher(CharSequence anInput) Returns the shared matcher (initialized to the given char sequence if not yet created).getName()Returns the regex name.Returns the regex pattern.Returns the compiled pattern.intReturns pattern compile flags.static booleanisAncharChar(char c) Utility method to return whether char is an anchor char.booleanReturns whether pattern is literal.static booleanisSpecialChar(char c) Utility method to return whether given character is a special char.voidsetLiteral(boolean aFlag) Sets whether pattern is literal.voidSets the regex name.voidsetPattern(String aPattern) Sets the pattern.toString()Returns a string representation of regex.
- 
Field Details- 
LetterLower- See Also:
 
- 
LetterUpper- See Also:
 
- 
Digit- See Also:
 
- 
WhiteSpace- See Also:
 
 
- 
- 
Constructor Details- 
Regexpublic Regex()Creates a new regex.
- 
RegexCreates a new regex with given pattern and name.
- 
RegexCreates a new regex with given pattern and name.
 
- 
- 
Method Details- 
getNameReturns the regex name.
- 
setNameSets the regex name.
- 
getPatternReturns the regex pattern.
- 
setPatternSets the pattern.
- 
isLiteralpublic boolean isLiteral()Returns whether pattern is literal.
- 
setLiteralpublic void setLiteral(boolean aFlag) Sets whether pattern is literal.
- 
getPatternCompiledReturns the compiled pattern.
- 
getPatternCompileFlagspublic int getPatternCompileFlags()Returns pattern compile flags.
- 
getMatcherReturns the shared matcher (initialized to the given char sequence if not yet created).
- 
getLiteralLengthpublic int getLiteralLength()Returns the literal length of this regex (the number of literal chars in the prefix).
- 
getLiteralCharpublic char getLiteralChar()Returns the first literal in regex pattern (or 0 if not literal).
- 
addGroupAdds a group.
- 
addCharsAdds a letter.
- 
addCharAdds a literal char.
- 
addLetterAdds any letter.
- 
addLetterLowerAdds any letter.
- 
addLetterUpperAdds any letter.
- 
addAnyCharAdds any char (doesn't include newlines).
- 
addDigitAdds a digit: [0-9].
- 
addNonDigitAdds a non-digit: [^0-9].
- 
addWhitespaceAdds whitespace char [ \t\n\x0B\f\r].
- 
addNonWhitespaceAdds non-whitespace char: [^\s].
- 
addWordCharacterAdds a word character: [a-zA-Z_0-9].
- 
addNonWordCharacterAdds a non-word character: [^\w].
- 
toStringReturns a string representation of regex.
- 
isSpecialCharpublic static boolean isSpecialChar(char c) Utility method to return whether given character is a special char.
- 
isAncharCharpublic static boolean isAncharChar(char c) Utility method to return whether char is an anchor char.
- 
getLiteralLengthReturns the literal length of pattern.
- 
getLiteralCharReturns the first char of a pattern, if it's a literal char.
 
-