|
So there would be a standpoint assumed: "" is at the range scanned by the regular expression engine, expecially when the * existed.
Here is the reference obtained from JDK-1.5-document
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
group
public String group()返回由以前匹配操作所匹配的输入子序列。
对于具有输入序列 s 的匹配器 m,表达式 m.group() 和 s.substring(m.start(), m.end()) 是等效的。
注意,某些模式(例如,a*)匹配空字符串。当模式成功匹配输入中的空字符串时,此方法将返回空字符串。
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
In my mind, that means there would be somethine special occurred when the symbol "*" existed.
So the empty string would be scanned at this time. The greedy quantifier "*" is responsible for the source data, as much as possible, so, taking "//w*" for instance, all the string would be poped and the index is moved to the end of the data, which is 6 pointing to the string "f". So the index of start and end is 6 and 6 after the scanning with * for the first time.
[ 本帖最后由 sinkeler 于 2008-1-25 16:58 编辑 ] |
|