Javatpoint Logo
Javatpoint Logo

Java Matcher matches() method

The matches() method of Matcher class is used to match the input sequence against the whole text. It takes care of matching of the pattern from the beginning to the end. While the lookingAt method matches the regular expression against the beginning of the text only.

Syntax:

Parameter:

No Parameter

Returns:

true if, and only if, the entire region sequence matches this matcher's pattern

Example 1

Test it Now

Output:

matches = true

Example 2

Test it Now

Output:

start : 0 End : 29
Next TopicJava Matcher class




Help Others, Please Share

facebook twitter pinterest