Matcher (Java SE 26 & JDK 26)
- All Implemented Interfaces:
MatchResult
-
Method Summary
Implements a non-terminal append-and-replace step.
Implements a non-terminal append-and-replace step.
Implements a terminal append-and-replace step.
Implements a terminal append-and-replace step.
intend()Returns the offset after the last character matched.
intend(int group) Returns the offset after the last character of the subsequence captured by the given group during the previous match operation.
intReturns the offset after the last character of the subsequence captured by the given named-capturing group during the previous match operation.
booleanfind()Attempts to find the next subsequence of the input sequence that matches the pattern.
booleanfind(int start) Resets this matcher and then attempts to find the next subsequence of the input sequence that matches the pattern, starting at the specified index.
group()Returns the input subsequence matched by the previous match.
group(int group) Returns the input subsequence captured by the given group during the previous match operation.
Returns the input subsequence captured by the given named-capturing group during the previous match operation.
intReturns the number of capturing groups in this matcher's pattern.
booleanQueries the anchoring of region bounds for this matcher.
booleanhasMatch()Returns whether
thiscontains a valid match from a previous match or find operation.booleanQueries the transparency of region bounds for this matcher.
booleanhitEnd()Returns true if the end of input was hit by the search engine in the last match operation performed by this matcher.
booleanAttempts to match the input sequence, starting at the beginning of the region, against the pattern.
booleanmatches()Attempts to match the entire region against the pattern.
Returns an unmodifiable map from capturing group names to group numbers.
pattern()Returns the pattern that is interpreted by this matcher.
Returns a literal replacement
Stringfor the specifiedString.region(int start, int end) Sets the limits of this matcher's region.
intReports the end index (exclusive) of this matcher's region.
intReports the start index of this matcher's region.
Replaces every subsequence of the input sequence that matches the pattern with the given replacement string.
Replaces every subsequence of the input sequence that matches the pattern with the result of applying the given replacer function to the match result of this matcher corresponding to that subsequence.
Replaces the first subsequence of the input sequence that matches the pattern with the given replacement string.
Replaces the first subsequence of the input sequence that matches the pattern with the result of applying the given replacer function to the match result of this matcher corresponding to that subsequence.
booleanReturns true if more input could change a positive match into a negative one.
reset()Resets this matcher with a new input sequence.
results()Returns a stream of match results for each subsequence of the input sequence that matches the pattern.
intstart()Returns the start index of the previous match.
intstart(int group) Returns the start index of the subsequence captured by the given group during the previous match operation.
intReturns the start index of the subsequence captured by the given named-capturing group during the previous match operation.
Returns the match state of this matcher as a
MatchResult.toString()Returns the string representation of this matcher.
useAnchoringBounds(boolean b) Sets the anchoring of region bounds for this matcher.
Changes the
Patternthat thisMatcheruses to find matches with.useTransparentBounds(boolean b) Sets the transparency of region bounds for this matcher.
Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitCreates and returns a copy of this object.
booleanIndicates whether some other object is "equal to" this one.
protected voidDeprecated, for removal: This API element is subject to removal in a future version.
Returns the runtime class of this
Object.intReturns a hash code value for this object.
final voidWakes up a single thread that is waiting on this object's monitor.
final voidWakes up all threads that are waiting on this object's monitor.
final voidCauses the current thread to wait until it is awakened, typically by being notified or interrupted.
final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Method Details
-
pattern
-
toMatchResult
-
usePattern
-
reset
-
reset
-
start
-
start
-
start
-
end
-
end
-
end
-
group
-
group
-
group
-
groupCount
-
matches
-
find
-
find
-
lookingAt
-
quoteReplacement
-
appendReplacement
-
appendReplacement
-
appendTail
-
appendTail
-
replaceAll
-
replaceAll
-
results
-
replaceFirst
-
replaceFirst
-
region
-
regionStart
-
regionEnd
-
hasTransparentBounds
-
useTransparentBounds
-
hasAnchoringBounds
-
useAnchoringBounds
-
toString
-
hitEnd
-
requireEnd
-
namedGroups
-
hasMatch
-