*
Causes the resulting RE to match 0 or more repetitions of the preceding RE, as many repetitions as are possible. ab* will match ‘a’, ‘ab’, or ‘a’ followed by any number of ‘b’s.
+
Causes the resulting RE to match 1 or more repetitions of the preceding RE. ab+ will match ‘a’ followed by any non-zero number of ‘b’s; it will not match just ‘a’.
见Regular Expression Syntax。在
如果您担心为什么} 只扫描第一个匹配项。如果要查找所有匹配项,请查看^{} 。在
ab*
只匹配第一个a
,那么从技术上讲它不匹配。问题在于您如何使用模式: ^{http://www.rexegg.com/regex-quickstart.html是正则表达式的一个很好的资源
*字符表示查找0或更多 这将找到a和0 b
+字符表示查找1个或多个
所以(ab+)会找到abbb
相关问题 更多 >
编程相关推荐