Notepad++ Regex Backreference syntax in Search/Replace - \1 or $1

前端 未结 1 1409
挽巷
挽巷 2020-12-05 17:00

I have tried to use the Notepad++ Search/Replace with a Regular Expression to replace specific words with shorter versions of those words.


I used the following

相关标签:
1条回答
  • 2020-12-05 17:54

    Notepad++'s earlier versions (v5.9.8 and prior) only supported standard POSIX Regular Expressions. However, full PCRE (Perl Compatible Regular Expression) Search/Replace support was added in version 6.0:

    New features and enhancement in Notepad++ 6.0:

    • PCRE (Perl Compatible Regular Expressions) is supported.

    This means that if you're using Notepad++ v6.0 or any newer version (e.g v6.1.5), you can use the PCRE syntax, and use $1 instead of \1 for backreference, but it won't be compatible with earlier versions of Notepad++ (prior to version 6.0). Other than that, they're similar.

    For more info regarding the differences between the backreference syntax and the reasons behind the new syntax support, see Backreferences syntax in replacement strings (why dollar sign?).

    A useful tutorial on how to use regular expressions in Notepad++ can be found here.

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