Java Matcher useAnchoringBounds() MethodThe 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. SyntaxParametersb - a boolean indicating whether or not to use anchoring bounds. Returnsthis matcher Since1.5 Example 1Test it NowOutput of the above program: true Example 2Test it NowOutput of the above program: true java.util.regex.Matcher[pattern=^<foo> region=0,15 lastmatch=<foo>] Example 3Test it NowOutput 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
|