Name
java.util.regex.Matcher
Description
Models a 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
)
Appends 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 lookingAt( )
True if match is at beginning of input.
boolean matches( )
Return true if
Pattern
matches entire input string.Pattern pattern( )
Return
Pattern
object used by thisMatcher
.String replaceAll(String
replacement
)
Replace every match with
replacement
.String replaceFirst(String
replacement
)
Replace first match with
replacement
.Matcher reset( )
Reset this matcher so that the next match starts at the beginning of the input string.
Matcher reset(CharSequence
input
)
Reset this matcher with new
input
.int start( )
Index of first character matched.
int start(int
group
)
Index of first character matched in captured substring,
group
.
Get Regular Expression Pocket Reference 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.