VOOZH about

URL: https://www.geeksforgeeks.org/java/matcher-requireend-method-in-java-with-examples/

⇱ Matcher requireEnd() method in Java with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Matcher requireEnd() method in Java with Examples

Last Updated : 27 Nov, 2018
The requireEnd() method of Matcher Class is used to check if any combination of anchors has caused the match to be bounded at the end. These anchors can be any anchor like a word anchor, for instance, or a lookahead. This method returns a boolean value stating the same. Syntax:
public boolean requireEnd()
Parameters: This method takes no parameters. Return Value: This method returns a boolean value stating whether if any combination of anchors has caused the match to be bounded at the end. Below examples illustrate the Matcher.requireEnd() method: Example 1:
Output:
Has any anchor bounded the search: true
Example 2:
Output:
Has any anchor bounded the search: false
Reference: https://docs.oracle.com/javase/9/docs/api/java/util/regex/Matcher.html#requireEnd--
Comment