Replace with whole match value using Notepad++ regex search and replace

前端 未结 1 1695
小鲜肉
小鲜肉 2020-12-20 02:51

I am using the following expression:

Find what: [0-9]

But what should I write in Replace with field if I want to add specific

相关标签:
1条回答
  • 2020-12-20 03:35

    The replacement can be

    <sup>$0</sup>
    

    or

    <sup>$&</sup>
    

    Note that the $0 / ${0} / $&, or even $MATCH and ${^MATCH} backrefrence inserts the whole match.

    See the Substitutions section:

    $&, $MATCH, ${^MATCH}
           The whole matched text.

    and

    $n, ${n}, \n
          Returns what matched the subexpression numbered n. Negative indices are not alowed.

    Note that a match value is usually stored as Group 0 inside a match object.

    However, \0 as of now does not work (Notepad++ v.6.9), it looks like it is treated as a NUL character and truncates the replacement pattern right at the location where it is located.

    0 讨论(0)
提交回复
热议问题