public class NamedRegexp extends Object implements Regexp, Serializable
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
CANON_EQ
|
static int |
CASE_INSENSITIVE
|
static int |
COMMENTS
|
static int |
DOTALL
|
static int |
LITERAL
|
static int |
MULTILINE
|
static int |
UNICODE_CASE
|
static int |
UNIX_LINES
|
| 构造器和说明 |
|---|
NamedRegexp(Pattern pattern) |
NamedRegexp(String pattern) |
NamedRegexp(String regex,
int flags)
Constructs a named pattern with the given regular expression and flags
|
| 限定符和类型 | 方法和说明 |
|---|---|
static NamedRegexp |
compile(String regex)
Compiles the given regular expression into a pattern
|
static NamedRegexp |
compile(String regex,
int flags)
Compiles the given regular expression into a pattern with the given flags
|
boolean |
equals(Object obj) |
int |
flags()
Returns this pattern's match flags
|
List<String> |
getNamedGroups()
Gets the names of all capture groups
|
Option |
getOption() |
String |
getPattern()
Returns the pattern that is interpreted by this matcher.
|
int |
hashCode() |
RegexpMatcher |
matcher(CharSequence input)
Creates a matcher that will match the given input against this pattern.
|
Pattern |
pattern()
Returns the wrapped
Pattern |
static String |
quote(String s) |
String[] |
split(CharSequence input)
Splits the given input sequence around matches of this pattern.
|
String[] |
split(CharSequence input,
int limit)
Splits the given input sequence around matches of this pattern.
|
String |
toString()
Returns a string representation of this pattern
|
public static final int UNIX_LINES
public static final int CASE_INSENSITIVE
public static final int COMMENTS
public static final int MULTILINE
public static final int LITERAL
public static final int DOTALL
public static final int UNICODE_CASE
public static final int CANON_EQ
public NamedRegexp(String regex, int flags)
regex - the expression to be compiledflags - Match flags, a bit mask that may include:
public NamedRegexp(Pattern pattern)
public NamedRegexp(String pattern)
public static NamedRegexp compile(String regex)
regex - the expression to be compiledpublic static NamedRegexp compile(String regex, int flags)
regex - the expression to be compiledflags - Match flags, a bit mask that may include:
public int flags()
public RegexpMatcher matcher(CharSequence input)
public String getPattern()
RegexpgetPattern 在接口中 Regexppublic List<String> getNamedGroups()
getNamedGroups 在接口中 Regexppublic String[] split(CharSequence input, int limit)
The array returned by this method contains each substring of the input sequence that is terminated by another subsequence that matches this pattern or is terminated by the end of the input sequence. The substrings in the array are in the order in which they occur in the input. If this pattern does not match any subsequence of the input then the resulting array has just one element, namely the input sequence in string form.
The limit parameter controls the number of times the pattern is applied and therefore affects the length of the resulting array. If the limit n is greater than zero then the pattern will be applied at most n - 1 times, the array's length will be no greater than n, and the array's last entry will contain all input beyond the last matched delimiter. If n is non-positive then the pattern will be applied as many times as possible and the array can have any length. If n is zero then the pattern will be applied as many times as possible, the array can have any length, and trailing empty strings will be discarded.
public String[] split(CharSequence input)
public String toString()
Copyright © 2022. All rights reserved.