Replacing digits immediately after a saved pattern

前端 未结 2 811
天涯浪人
天涯浪人 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:28

    The replacement term \15 is being interpreted as "group 15" - you must escape the "5":

    Try replacing with \1\\5, or if that doesn't work (I don't have textwrangler handy) use a look behind:

    Search: (?<=text)9
    Replace: 5
    

    The look behind doesn't consume input, so only the "9" is matched.

提交回复
热议问题