Java Matcher hitEnd() Method

9 Nov 2024 | 2 min read

Java Matcher hitEnd method of Java Matcher class is used to check the hits by the search engine. If the end of input was hit by the search engine in the last match operation performed by this matcher, then it returns true.

Syntax:

Parameter

NA

Returns

true if the end of input was hit in the last match; false otherwise

Since

1.5

Example 1

Output:

find(): false hitEnd(): true 

Example 2

Output:

find() : true hitEnd(): true number of match by find() method : 2 

Example 3

Output:

First Capturing Group, (a*b) Match String end(): 7 First Capturing Group, (a*b) Match String end(): 14 First Capturing Group, (a*b) Match String end(): 20 hitEnd(): true