Modifier and Type | Field and Description |
---|---|
static int |
MISMATCH
Returned by
match(CharSequence, int, int) method when match fails. |
Constructor and Description |
---|
Pattern() |
Modifier and Type | Method and Description |
---|---|
Pattern |
atLeast(int min)
Returns
Pattern object that matches this pattern for at least min times. |
Pattern |
atMost(int max)
Returns
Pattern object that matches this pattern for up to max times. |
Pattern |
ifelse(Pattern consequence,
Pattern alternative)
Returns
Pattern object that, if this pattern matches,
matches the remaining input against consequence pattern, or otherwise matches against
alternative pattern. |
Pattern |
many()
Returns a
Pattern object that matches this pattern for 0 or more times. |
Pattern |
many(int min)
Deprecated.
Use
atLeast(int) instead. |
Pattern |
many1()
Returns a
Pattern object that matches this pattern for 1 or more times. |
abstract int |
match(CharSequence src,
int begin,
int end)
Matches character range against the pattern.
|
Pattern |
next(Pattern next)
|
Pattern |
not()
Returns a
Pattern object that only matches if this pattern mismatches, 0 is returned
otherwise. |
Pattern |
optional()
Returns a
Pattern object that matches with 0 length even if this mismatches. |
Pattern |
or(Pattern p2)
|
Pattern |
peek()
Returns
Pattern object that matches with match length 0 if this Pattern object matches. |
Pattern |
repeat(int n)
Deprecated.
Use
times(int) instead. |
Pattern |
some(int max)
Deprecated.
Use
atMost(int) instead. |
Pattern |
some(int min,
int max)
Deprecated.
Use
times(int, int) instead. |
Pattern |
times(int n)
Returns
Pattern object that matches the input against this pattern for n times. |
Pattern |
times(int min,
int max)
|
Parser<Void> |
toScanner(String name)
Returns a scanner parser using
this pattern. |
public static final int MISMATCH
match(CharSequence, int, int)
method when match fails.public abstract int match(CharSequence src, int begin, int end)
end - begin
.src
- the source string.begin
- the beginning index in the sequence.end
- the end index of the source string (exclusive).
NOTE: the range is [begin, end)
.public final Pattern next(Pattern next)
Pattern
object that sequentially matches the character range against
this
and then next
. If both succeeds, the entire match length is returned.next
- the next pattern to match.public final Pattern optional()
Pattern
object that matches with 0 length even if this
mismatches.public final Pattern many()
Pattern
object that matches this pattern for 0 or more times.
The total match length is returned.@Deprecated public final Pattern many(int min)
atLeast(int)
instead.Pattern
object that matches this pattern for at least min
times.
The total match length is returned.min
- the minimal number of times to match.public final Pattern atLeast(int min)
Pattern
object that matches this pattern for at least min
times.
The total match length is returned.min
- the minimal number of times to match.public final Pattern many1()
Pattern
object that matches this pattern for 1 or more times.
The total match length is returned.@Deprecated public final Pattern some(int max)
atMost(int)
instead.Pattern
object that matches this pattern for up to max
times.
The total match length is returned.max
- the maximal number of times to match.public final Pattern atMost(int max)
Pattern
object that matches this pattern for up to max
times.
The total match length is returned.max
- the maximal number of times to match.@Deprecated public final Pattern some(int min, int max)
times(int, int)
instead.Pattern
object that matches this pattern for at least min
times
and up to max
times. The total match length is returned.min
- the minimal number of times to match.max
- the maximal number of times to match.public final Pattern times(int min, int max)
Pattern
object that matches this pattern for at least min
times
and up to max
times. The total match length is returned.min
- the minimal number of times to match.max
- the maximal number of times to match.public final Pattern not()
Pattern
object that only matches if this pattern mismatches, 0 is returned
otherwise.public final Pattern peek()
Pattern
object that matches with match length 0 if this Pattern object matches.public final Pattern ifelse(Pattern consequence, Pattern alternative)
Pattern
object that, if this pattern matches,
matches the remaining input against consequence
pattern, or otherwise matches against
alternative
pattern.@Deprecated public final Pattern repeat(int n)
times(int)
instead.Pattern
object that matches the input against this pattern for n
times.public final Pattern times(int n)
Pattern
object that matches the input against this pattern for n
times.public final Parser<Void> toScanner(String name)
this
pattern.
Convenient short-hand for Scanners.pattern(org.jparsec.pattern.Pattern, java.lang.String)
.Copyright © 2013–2016 jparsec. All rights reserved.