Java Matcher start() MethodThis method is used to return the start index of the previous match. To return the offset of first matched character, we need to use the find method to match the pattern character by character. SignatureThere are 3 types of start method in java. The signature of the start methods is given below.
Specified by:start in interface MatchResult Returns:The index of the first character matched Throws:IllegalStateException- If no match has yet been attempted, or if the previous match operation failed Example 1Output: Start position :1, End position : 4 Start position :4, End position : 7 Start position :7, End position : 10 Example 2Output: start position of Matching String java 2 Example 3Output: Start position of matching 5 Next TopicJava-matcher-useanchoringbounds-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