[技]如何在 notepad++ 里面使用正则表达式进行替换

Posted ybhello

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[技]如何在 notepad++ 里面使用正则表达式进行替换相关的知识,希望对你有一定的参考价值。

范例:

替换 i++, j++ 为 i = i + 10, j = j + 10。

 

替换前:

int main(int argc, char *argv[])

    int i;
    int j;
    
    
    i++;
    j++;

 

替换后:

int main(int argc, char *argv[])

    int i;
    int j;
    
    
    i = i + 10;
    j = j + 10;

 

 

1. 正则表达式

() 包裹的内容,表示关键字,会被提取出来,在替换中可以使用 $1 $2 等来表示包裹的内容。

(\w)\+\+

2. 替换

$1 = $1 + 10

 

以上是关于[技]如何在 notepad++ 里面使用正则表达式进行替换的主要内容,如果未能解决你的问题,请参考以下文章