Modifier and Type | Method and Description |
---|---|
int |
end()
返回最后一个字符匹配的偏移量。
|
int |
end(int group)
返回偏移后序列捕获的组在本场比赛的最后一个字符。
|
String |
group()
返回由以前的匹配输入序列。
|
String |
group(int group)
返回被给定组以前的匹配操作在输入序列。
|
int |
groupCount()
返回在这个匹配结果的模式中捕获组的数量。
|
int |
start()
返回匹配的开始索引。
|
int |
start(int group)
返回序列捕获的组在这场比赛开始指数。
|
int start()
IllegalStateException
尚未尝试,或者以前的比赛,操作失败
int start(int group)
Capturing groups索引从左到右,在一开始。零组表示整个格局,所以表达m.start(0)相当于m.start()。
group
-一个捕获组在匹配模式的指标
IllegalStateException
尚未尝试,或者以前的比赛,操作失败
IndexOutOfBoundsException
-如果没有捕获组在给定的索引模式
int end()
IllegalStateException
尚未尝试,或者以前的比赛,操作失败
int end(int group)
Capturing groups索引从左到右,在一开始。零组表示整个格局,所以表达m.end(0)相当于m.end()。
group
-一个捕获组在匹配模式的指标
IllegalStateException
尚未尝试,或者以前的比赛,操作失败
IndexOutOfBoundsException
-如果没有捕获组在给定的索引模式
String group()
对于一个输入序列的匹配M,表达m.group()和s.substring(m start(), m.end())是等价的。
值得注意的是,一些模式,例如a*,匹配空字符串。当模式成功地与输入中的空字符串相匹配时,该方法将返回空字符串。
IllegalStateException
尚未尝试,或者以前的比赛,操作失败
String group(int group)
一个匹配M,输入序列,和群G指数,表达m.group(g)和s.substring(m start(g), m.end(g))是等价的。
Capturing groups索引从左到右,在一开始。零组表示整个格局,所以表达m.group(0)相当于m.group()。
如果匹配成功了但组指定不匹配的输入序列的任何部分,然后null返回。请注意,某些群体,例如(a*),匹配空字符串。当这样一个组成功地与输入中的空字符串匹配时,这种方法将返回空字符串。
group
-一个捕获组在匹配模式的指标
IllegalStateException
尚未尝试,或者以前的比赛,操作失败
IndexOutOfBoundsException
-如果没有捕获组在给定的索引模式
int groupCount()
组零表示的是整个模式的约定。它不包括在这个计数中。
任何非负整数小于或等于该方法返回的值必须保证这种匹配有效的组索引。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.