Name
java.util.regex.Matcher
Description
Models a stateful regular expression pattern matcher and pattern matching results.
Methods
Matcher appendReplacement(StringBuffer
sb
, String
replacement
)
Append substring preceding match and
replacement
tosb
.StringBuffer appendTail(StringBuffer
sb
)
Append substring following end of match to
sb
.int end( )
Index of the first character after the end of the match.
int end(int
group
)
Index of the first character after the text captured by
group
.boolean find( )
Find the next match in the input string.
boolean find(int
start
)
Find the next match after character position
start
.String group( )
Text matched by this
Pattern
.String group(int
group
)
Text captured by capture group
group
.int groupCount( )
Number of capturing groups in
Pattern
.boolean hasAnchoringBounds( )
Return true if this
Matcher
uses anchoring bounds so that anchor operators match at the region boundaries, not just at the start and end of the target string.boolean hasTransparentBounds( )
True if this
Matcher
uses transparent bounds so that lookaround operators can see outside the current search bounds. Defaults to false.boolean hitEnd( )
True if the last match attempts to inspect beyond the end of the input. In scanners, this is an indication that more input may have resulted in a longer match.
boolean lookingAt( )
True if the pattern matches at the beginning of the input.
boolean matches( )
Return true if
Pattern
matches entire input string.Pattern pattern( )
Return
Pattern
object used by thisMatcher
.static ...
Get Regular Expression Pocket Reference, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.