|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wicket.util.parse.metapattern.MetaPattern
public class MetaPattern
Useful class for constructing readable and reusable regular expressions.
MetaPatterns can be constructed from a simple regular expression String, from other MetaPatterns (copy constructor), from a list of MetaPatterns or from an array of MetaPatterns. In this way, it is easy to build up larger patterns while transparently binding the capturing groups of each MetaPattern for easy object oriented access to capturing group matches.
A given MetaPattern can be converted to a Matcher or Pattern. Groups within the MetaPattern can be used to automatically reference capturing group values when a match is made with a Matcher object.
A variety of static constants are provided for use in constructing compound MetaPatterns. Also, a number of simple parsers have been constructed using MetaPatterns in the parsers subpackage.
Field Summary | |
---|---|
static MetaPattern |
AMPERSAND
Constant for ampersand. |
static MetaPattern |
ANYTHING
Constant for anything (string). |
static MetaPattern |
ANYTHING_NON_EMPTY
Constant for anything non-empty (string). |
static MetaPattern |
AT_SIGN
Constant for at. |
static MetaPattern |
BACKSLASH
Constant for backslash. |
static MetaPattern |
COLON
Constant for colon. |
static MetaPattern |
COMMA
Constant for comma. |
static MetaPattern |
DASH
Constant for dash. |
static MetaPattern |
DIGIT
Constant for digit. |
static MetaPattern |
DIGITS
Constant for digits. |
static MetaPattern |
DOLLAR_SIGN
Constant for dollar. |
static MetaPattern |
DOT
Constant for dot. |
static MetaPattern |
DOUBLE_QUOTED_STRING
Constant for a double quoted string. |
static MetaPattern |
EQUALS
Constant for equals. |
static MetaPattern |
EXCLAMATION_POINT
Constant for excl. |
static MetaPattern |
FLOATING_POINT_NUMBER
Constant for a floating point number. |
static MetaPattern |
HEXADECIMAL_DIGIT
Constant for hex digit. |
static MetaPattern |
HEXADECIMAL_DIGITS
Constant for hex digits. |
static MetaPattern |
INTEGER
Constant for an integer (of any size). |
static MetaPattern |
LEFT_CURLY
Constant for left curly braces. |
static MetaPattern |
LEFT_PAREN
Constant for left paren. |
static MetaPattern |
LEFT_SQUARE
Constant for left square bracket. |
static MetaPattern |
MINUS
Constant for minus. |
static MetaPattern |
NON_WORD
Constant for non-word. |
static MetaPattern |
OPTIONAL_STRING
Constant for an optional string. |
static MetaPattern |
OPTIONAL_WHITESPACE
Constant for optional whitespace. |
static MetaPattern |
OPTIONAL_WORD
Constant for an optional word. |
static MetaPattern |
PERCENT
Constant for percent. |
static MetaPattern |
PERL_INTERPOLATION
Constant for perl interpolation. |
static MetaPattern |
PIPE
Constant for pipe. |
static MetaPattern |
PLUS
Constant for plus. |
static MetaPattern |
POSITIVE_INTEGER
Constant for a positive integer. |
static MetaPattern |
POUND_SIGN
Constant for pound. |
static MetaPattern |
RIGHT_CURLY
Constant for right curly braces. |
static MetaPattern |
RIGHT_PAREN
Constant for right paren. |
static MetaPattern |
RIGHT_SQUARE
Constant for right square bracket. |
static MetaPattern |
SEMICOLON
Constant for semicolon. |
static MetaPattern |
SLASH
Constant for slash. |
static MetaPattern |
STAR
Constant for star. |
static MetaPattern |
STRING
Constant for a string. |
static MetaPattern |
TILDE
Constant for tilde. |
static MetaPattern |
UNDERSCORE
Constant for underscore. |
static MetaPattern |
VARIABLE_NAME
Constant for a variable name. |
static MetaPattern |
WHITESPACE
Constant for whitespace. |
static MetaPattern |
WORD
Constant for a word. |
static MetaPattern |
XML_ATTRIBUTE_NAME
Constant for an XML attribute name. |
static MetaPattern |
XML_ELEMENT_NAME
Constant for an XML element name. |
Constructor Summary | |
---|---|
MetaPattern(java.util.List<MetaPattern> patterns)
Constructs from a list of MetaPatterns |
|
MetaPattern(MetaPattern pattern)
Copy constructor. |
|
MetaPattern(MetaPattern[] patterns)
Constructs from an array of MetaPatterns. |
|
MetaPattern(java.lang.String pattern)
Constructor for a simple pattern. |
Method Summary | |
---|---|
java.util.regex.Matcher |
matcher(java.lang.CharSequence input)
Creates a matcher against a given input character sequence. |
java.util.regex.Matcher |
matcher(java.lang.CharSequence input,
int flags)
Creates a matcher with the given regexp compile flags. |
java.util.regex.Pattern |
pattern()
Gets the regular expression Pattern for this MetaPattern by compiling it. |
java.util.regex.Pattern |
pattern(int flags)
Gets the regular expression Pattern for this MetaPattern by compiling it using the given flags. |
java.lang.String |
toString()
Converts this MetaPattern to a String. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final MetaPattern WHITESPACE
public static final MetaPattern OPTIONAL_WHITESPACE
public static final MetaPattern NON_WORD
public static final MetaPattern COMMA
public static final MetaPattern COLON
public static final MetaPattern SEMICOLON
public static final MetaPattern SLASH
public static final MetaPattern BACKSLASH
public static final MetaPattern DOT
public static final MetaPattern PLUS
public static final MetaPattern MINUS
public static final MetaPattern DASH
public static final MetaPattern UNDERSCORE
public static final MetaPattern AMPERSAND
public static final MetaPattern PERCENT
public static final MetaPattern DOLLAR_SIGN
public static final MetaPattern POUND_SIGN
public static final MetaPattern AT_SIGN
public static final MetaPattern EXCLAMATION_POINT
public static final MetaPattern TILDE
public static final MetaPattern EQUALS
public static final MetaPattern STAR
public static final MetaPattern PIPE
public static final MetaPattern LEFT_PAREN
public static final MetaPattern RIGHT_PAREN
public static final MetaPattern LEFT_CURLY
public static final MetaPattern RIGHT_CURLY
public static final MetaPattern LEFT_SQUARE
public static final MetaPattern RIGHT_SQUARE
public static final MetaPattern DIGIT
public static final MetaPattern DIGITS
public static final MetaPattern INTEGER
public static final MetaPattern FLOATING_POINT_NUMBER
public static final MetaPattern POSITIVE_INTEGER
public static final MetaPattern HEXADECIMAL_DIGIT
public static final MetaPattern HEXADECIMAL_DIGITS
public static final MetaPattern ANYTHING
public static final MetaPattern ANYTHING_NON_EMPTY
public static final MetaPattern WORD
public static final MetaPattern OPTIONAL_WORD
public static final MetaPattern VARIABLE_NAME
public static final MetaPattern XML_ELEMENT_NAME
public static final MetaPattern XML_ATTRIBUTE_NAME
public static final MetaPattern PERL_INTERPOLATION
public static final MetaPattern DOUBLE_QUOTED_STRING
public static final MetaPattern STRING
public static final MetaPattern OPTIONAL_STRING
Constructor Detail |
---|
public MetaPattern(java.lang.String pattern)
pattern
- The regular expression pattern to compilepublic MetaPattern(MetaPattern pattern)
pattern
- The meta pattern to copypublic MetaPattern(MetaPattern[] patterns)
patterns
- Array of MetaPatternspublic MetaPattern(java.util.List<MetaPattern> patterns)
patterns
- List of MetaPatternsMethod Detail |
---|
public final java.util.regex.Matcher matcher(java.lang.CharSequence input)
input
- The input to match against
public final java.util.regex.Matcher matcher(java.lang.CharSequence input, int flags)
input
- The input to matchflags
- One or more of the standard Java regular expression compile flags (see
Pattern.compile(String, int)
)
public final java.util.regex.Pattern pattern()
public final java.util.regex.Pattern pattern(int flags)
flags
- One or more of the standard Java regular expression compile flags (see
Pattern.compile(String, int)
)
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |