📜  Java正则表达式-MatchResult接口

📅  最后修改于: 2020-11-14 10:18:25             🧑  作者: Mango


介绍

java.util.regex.MatchResult接口表示匹配操作的结果。此接口包含用于确定与正则表达式匹配的结果的查询方法。可以看到匹配边界,组和组边界,但不能通过MatchResult对其进行修改。

接口声明

以下是java.util.regex.MatchResult接口的声明-

public interface MatchResult

接口方式

Sr.No Method & Description
1 int end()

Returns the offset after the last character matched.

2 int end(int group)

Returns the offset after the last character of the subsequence captured by the given group during this match.

3 String group()

Returns the input subsequence matched by the previous match.

4 String group(int group)

Returns the input subsequence captured by the given group during the previous match operation.

5 int groupCount()

Returns the number of capturing groups in this match result’s pattern.

6 int start()

Returns the start index of the match.

7 int start(int group)

Returns the start index of the subsequence captured by the given group during this match.