Replacing digits immediately after a saved pattern

前端 未结 2 812
天涯浪人
天涯浪人 2021-01-23 22:47

Searched pattern looks like text9

I search for (text)9

I want to replace with \\15 so that I would get text5

2条回答
  •  佛祖请我去吃肉
    2021-01-23 23:08

    As it turns out, the PCRE-style back-references do not work.

    So, you have to use \015 to replace with the text captured with the first capturing group (\01) and 5.

    Since there cannot be more than 99 capturing groups, and both the digits after \ are treated as back-reference group number, \01 is interpreted as the reference to the first group, and the rest are literal digits.

提交回复
热议问题