在Notepad ++中替换regexp capture-group?

Kaa*_*aah 73 regex notepad++

快速问题:我有一个正则表达式^(?:\b[A-Z]+\b\s+)+(.*)\d{8},它提供了两个捕获组.我想用空格替换捕获组1.那可能吗?

如果我替换为:\1它取代TEST TESTER Hello, world. Another word here. 75793250- > with Hello, world. Another word here.我想要这个结果:TEST TESTER 75793250.\1用空格替换.

Jer*_*rry 122

尝试使用:

^((?:\b[A-Z]+\b\s+)+)(?:.*)(\d{8})
Run Code Online (Sandbox Code Playgroud)

并替换为:

\1\2
Run Code Online (Sandbox Code Playgroud)


Ani*_*dha 8

为什么要这么做.

这样做吧

正则表达式:^(\b[A-Z]+\b\s+)+(?:.*)(\d{8})

用...来代替:\1 \2

  • “为什么要这么做。”?因为OP不知道,所以才问这个问题。像这样的Snark对任何人都没有好处。 (5认同)