本帖最后由 kkopopo 于 2014-3-24 19:37 编辑
Enter your regex: .*foo // 贪婪量词
Enter input string to search: xfooxxxxxxfoo
I found the text "xfooxxxxxxfoo" starting at index 0 and ending at index 13.
Enter your regex: .*?foo // 勉强量词
Enter input string to search: xfooxxxxxxfoo
I found the text "xfoo" starting at index 0 and ending at index 4.
I found the text "xxxxxxfoo" starting at index 4 and ending at index 13.
Enter your regex: .*+foo // 侵占量词
Enter input string to search: xfooxxxxxxfoo
No match found.
求解析为啥 最后一个侵占是匹配失败? 不应该有一个吗 ?
侵占不是一次性的吗? 那么整体的字符串xfooxxxxxxfoo 不正好匹配.*+foo
我感觉这个地方我理解的是错误的
|