Javatpoint Logo
Javatpoint Logo

Java Matcher useAnchoringBounds() Method

The useAnchoringBounds(boolean b) method of Matcher class checks whether this matcher has anchoring bounds enabled or not. The anchoring bound has true value by default. If the anchoring bound is enabled, the start and end of input match the '^' and '$' meta-characters, otherwise not.

Syntax

Parameters

b - a boolean indicating whether or not to use anchoring bounds.

Returns

this matcher

Since

1.5

Example 1

Test it Now

Output of the above program:

true

Example 2

Test it Now

Output of the above program:

true
java.util.regex.Matcher[pattern=^<foo> region=0,15 lastmatch=<foo>]

Example 3

Test it Now

Output of the above program:

true
java.util.regex.Matcher[pattern=<foo>* region=0,15 lastmatch=<foo>]
java.util.regex.Matcher[pattern=<foo>* region=0,15 lastmatch=<foo>]
Next TopicJava Matcher




Help Others, Please Share

facebook twitter pinterest