请教正则高手,下面这三个是什么意思?有范例或网站的教学吗?一直看不懂怎使用
1.
(?>regex)
x(?>\w+)x is more efficient than x\w+x if the second x cannot be matched.2.
?+, *+, ++ and {m,n}+
x++ is identical to (?>x+)3.
\G
\G[a-z] first matches a, then matches b and then fails to match in ab_cd.
1.
(?>regex)
x(?>\w+)x is more efficient than x\w+x if the second x cannot be matched.2.
?+, *+, ++ and {m,n}+
x++ is identical to (?>x+)3.
\G
\G[a-z] first matches a, then matches b and then fails to match in ab_cd.
i
in
inp
inpu
input
input
input i
input id
input id=
input id="
input id="t
input id="te
input id="tes
input id="test
input id="test" (固化分组:直接终止)开始匹配
i
in
inp
inpu
input
input
input i
input id
input id=
input id="
input id="t
input id="te
input id="tes
input id="test
input id="test" (没固化分组:回溯)
input id="test
input id="tes
input id="te
input id="t
input id="
input id=
input id
input i
input
inpu
inp
in
i
终止请教是不是这意思??
开始匹配
i
in
inp
inpu
input
input
input i
input id
input id=
input id="
input id="t
input id="te
input id="tes
input id="test
input id="test" (没固化分组:回溯)
n
np
npu
nput
……
如果理解有误请指正
回溯的过程是楼主在7楼说的过程,而不是从第二个字符开始位置0处整个表达式匹配失败后,会进行下一轮匹配,从位置1处开始匹配,但由于“<”无法匹配成功,所以后续轮次的尝试匹配都是以“<”的匹配失败,而导致整个表达式匹配失败而告终的年后工作一直特别忙,已经有几个月没写博客了,端午节整理一下关于固化分组的知识,节后发篇博客吧
(?(?=regex)then|else)
(?(?<=a)b|c) matches the second b and the first c in babxcac(?(1)then|else)
(a)?(?(1)b|c) matches ab, the first c and the second c in babxcac详细的解说