- Java Regex - Discussion
- Java Regex - Useful Resources
- Java Regex - Quick Guide
- Java Regex - Logical Operators
- Java Regex - Possessive quantifiers
- Java Regex - Reluctant quantifiers
- Java Regex - Greedy quantifiers
- Java Regex - Boundary Matchers
- Unicode Character Classes
- Java Regex - JAVA Character Classes
- POSIX Character Classes
- Predefined Character Classes
- Java Regex - Character Classes
- Java Regex - Characters
- PatternSyntaxException Class
- Java Regex - Matcher Class
- Java Regex - Pattern Class
- Java Regex - MatchResult Interface
- Java Regex - Capturing Groups
- Java Regex - Overview
- Java Regex - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Java Regex - Matcher Class
Introduction
The java.util.regex.Matcher class acts as an engine that performs match operations on a character sequence by interpreting a Pattern.
Class declaration
Following is the declaration for java.util.regex.Matcher class −
pubpc final class Matcher extends Object implements MatchResult
Class methods
Sr.No | Method & Description |
---|---|
1 | Implements a non-terminal append-and-replace step. |
2 | Implements a terminal append-and-replace step. |
3 | Returns the offset after the last character matched. |
4 | Returns the offset after the last character of the subsequence captured by the given group during the previous match operation. |
5 | Attempts to find the next subsequence of the input sequence that matches the pattern. |
6 | Resets this matcher and then attempts to find the next subsequence of the input sequence that matches the pattern, starting at the specified index. |
7 | Returns the input subsequence captured by the given group during the previous match operation. |
8 | Returns the input subsequence captured by the given named-capturing group during the previous match operation. |
9 | Returns the number of capturing groups in this matcher s pattern. |
10 | Queries the anchoring of region bounds for this matcher. |
11 | Queries the transparency of region bounds for this matcher. |
12 | Returns true if the end of input was hit by the search engine in the last match operation performed by this matcher. |
13 | Attempts to match the input sequence, starting at the beginning of the region, against the pattern. |
14 | Attempts to match the entire region against the pattern. |
15 | Returns the pattern that is interpreted by this matcher. |
16 | Returns a pteral replacement String for the specified String. |
17 | Sets the pmits of this matcher s region. |
18 | Reports the end index (exclusive) of this matcher s region. |
19 | Reports the start index of this matcher s region. |
20 | Replaces every subsequence of the input sequence that matches the pattern with the given replacement string. |
21 | Replaces the first subsequence of the input sequence that matches the pattern with the given replacement string. |
22 | Returns true if more input could change a positive match into a negative one. |
23 | Resets this matcher. |
24 | Resets this matcher with a new input sequence. |
25 | Returns the start index of the previous match. |
26 | Returns the start index of the subsequence captured by the given group during the previous match operation. |
27 | Returns the match state of this matcher as a MatchResult. |
28 | Returns the string representation of this matcher. |
29 | Sets the anchoring of region bounds for this matcher. |
30 | Changes the Pattern that this Matcher uses to find matches with. |
31 | Sets the transparency of region bounds for this matcher. |
Methods inherited
This class inherits methods from the following classes −
Java.lang.Object