请教正则高手,下面这三个是什么意思?有范例或网站的教学吗?一直看不懂怎使用
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.   

    1、固化分组,不会记录回溯状态,一旦匹配,就不会释放,Java中有占有优先量词*+、++这类的,比固化分组更简洁2、哦,这个就是占有优先量词了,.NET中是不支持的3、MSDN上说是指定匹配必须出现在上一个匹配结束的地方。与 Match.NextMatch() 一起使用时,此断言确保所有匹配都是连续的。基本上没用过,至今没遇到过需要它的应用场景
      

  2.   

    本帖最后由 lxcnn 于 2010-06-08 23:10:20 编辑
      

  3.   

    lxcnn高手,您说的跟英文写的一样难懂,可否给个较白话或是小范例?
      

  4.   

    开始匹配
    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
    终止请教是不是这意思??
      

  5.   

    本帖最后由 lxcnn 于 2010-06-08 23:32:09 编辑
      

  6.   

    不使用固话分组的情况理解错了如果不匹配,回溯,从第二个字符开始匹配,知道最后
    开始匹配
    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.   


    回溯的过程是楼主在7楼说的过程,而不是从第二个字符开始位置0处整个表达式匹配失败后,会进行下一轮匹配,从位置1处开始匹配,但由于“<”无法匹配成功,所以后续轮次的尝试匹配都是以“<”的匹配失败,而导致整个表达式匹配失败而告终的年后工作一直特别忙,已经有几个月没写博客了,端午节整理一下关于固化分组的知识,节后发篇博客吧
      

  8.   

    lxcnn高手如果开课指导(博客),可否多一些应用实例关于
    (?(?=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详细的解说