Java Matcher find() methodThe find method searches the specified pattern or the expression in the given subsequence characterwise and returns true otherwise it returns false. SignatureThere are 2 types of find method in java. The signature of find methods are given below
Parameterstart- the index to start searching for a match Returnstrue if, and only if, a subsequence of the input sequence starting at the given index matches this matcher's pattern ThrowsIndexOutOfBoundsException- If start is less than zero or if start is greater than the length of the input sequence. Example 1Output: Start position of matching String 5 End position of Matching String (java) 9 Start position of matching String 14 End position of Matching String (java) 18 Number of matches : 2 Example 2Output: Start position of matching String (java) 14 End position of Matching String (java) 18 Number of matches: 1 Next TopicJava-matcher-group-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India