| java.lang.Object java.util.regex.Pattern
Pattern | final public class Pattern implements Serializable(Code) | | Pattern implements a compiler for regular expressions as defined by the J2SE
specification. The regular expression syntax is largely similar to the syntax
defined by Perl 5 but has both omissions and extensions. A formal and
complete definition of the regular expression syntax is not provided by the
J2SE speTBD (TODO)
|
BACK_REF_NUMBER | final static int BACK_REF_NUMBER(Code) | | |
CANON_EQ | final public static int CANON_EQ(Code) | | |
CASE_INSENSITIVE | final public static int CASE_INSENSITIVE(Code) | | |
COMMENTS | final public static int COMMENTS(Code) | | |
DOTALL | final public static int DOTALL(Code) | | |
LITERAL | final public static int LITERAL(Code) | | |
MULTILINE | final public static int MULTILINE(Code) | | |
UNICODE_CASE | final public static int UNICODE_CASE(Code) | | |
UNIX_LINES | final public static int UNIX_LINES(Code) | | |
_DEBUG_ | final static boolean _DEBUG_(Code) | | |
flagsBitMask | final static int flagsBitMask(Code) | | Bit mask that includes all defined match flags
|
compCount | int compCount()(Code) | | |
compile | public static Pattern compile(String regex, int flags) throws PatternSyntaxException(Code) | | Return a compiled pattern corresponding to the input regular expression
string.
The input flags is a mask of the following flags:
UNIX_LINES (0x0001)
- Enables UNIX lines mode where only \n is recognized as a line
terminator. The default setting of this flag is off indicating
that all of the following character sequences are recognized as line
terminators: \n, \r, \r\n, NEL (\u0085), \u2028 and \u2029.
CASE_INSENSITIVE (0x0002)
- Directs matching to be done in a way that ignores differences in
case. If input character sequences are encoded in character sets other
than ASCII, then the UNICODE_CASE must also be set to enable Unicode case
detection.
UNICODE_CASE (0x0040)
- Enables Unicode case folding if used in conjunction with the
CASE_INSENSITIVE flag. If CASE_INSENSITIVE
is not set, then this flag has no effect.
COMMENTS (0x0004)
- Directs the pattern compiler to ignore whitespace and comments in
the pattern. Whitespace consists of sequences including only these
characters: SP (\u0020), HT (\t or \u0009), LF (\n or ), VT
(\u000b), FF (\f or \u000c), and CR (\r or ). A comment is any
sequence of characters beginning with the "#" (\u0023) character and
ending in a LF character.
MULTILINE (0x0008)
- Turns on multiple line mode for matching of character sequences. By
default, this mode is off so that the character "^" (\u005e) matches
the beginning of the entire input sequence and the character "$"
(\u0024) matches the end of the input character sequence. In multiple
line mode, the character "^" matches any character in the input sequence
which immediately follows a line terminator and the character "$" matches
any character in the input sequence which immediately precedes a line
terminator.
DOTALL (0x0020)
- Enables the DOT (".") character in regular expressions to match line
terminators. By default, line terminators are not matched by DOT.
CANON_EQ (0x0080)
- Enables matching of character sequences which are canonically
equivalent according to the Unicode standard. Canonical equivalence is
described here: http://www.unicode.org/reports/tr15/. By default,
canonical equivalence is not detected while matching.
Parameters: regex - A regular expression string. Parameters: flags - A set of flags to control the compilation of the pattern. A compiled pattern throws: PatternSyntaxException - If the input regular expression does not match the requiredgrammar. |
consCount | int consCount()(Code) | | |
flags | public int flags()(Code) | | Return the mask of flags used to compile the pattern
A mask of flags used to compile the pattern. |
getSupplement | static char getSupplement(char ch)(Code) | | Returns supplementary character. At this time only for ASCII chars.
|
groupCount | int groupCount()(Code) | | return number of groups found at compile time
|
matcher | public Matcher matcher(CharSequence cs)(Code) | | Create a matcher for this pattern and a given input character sequence
Parameters: cs - The input character sequence A new matcher |
pattern | public String pattern()(Code) | | Returns the pattern string passed to the compile method
A string representation of the pattern |
split | public String[] split(CharSequence input, int limit)(Code) | | Split an input string using the pattern as a token separator.
Parameters: input - Input sequence to tokenize Parameters: limit - If positive, the maximum number of tokens to return. Ifnegative, an indefinite number of tokens are returned. Ifzero, an indefinite number of tokens are returned but trailingempty tokens are excluded. A sequence of tokens split out of the input string. |
toString | public String toString()(Code) | | Return a textual representation of the pattern.
The regular expression string |
|
|