Pattern matcher(CharSequence) method in Java with Examples
The matcher(CharSequence) method of the Pattern class used to generate a matcher that will helpful to match the given input as parameter to method against this pattern. The Pattern.matcher() method is very helpful when we need to check a pattern against a text a single time, and the default settings of the Pattern class are appropriate.
public Matcher matcher(CharSequence input)
Parameters: This method accepts a single parameter input which represents the character sequence to be matched.
Return Value: This method returns a new matcher for this pattern.
Below programs illustrate the matcher(CharSequence) method:
found the Regex in text:geeksforgeeks starting index:0 and ending index:13
No match found
My Personal Notes arrow_drop_up
Please Login to comment...