在 Notepad++ 中替换正则表达式捕获组? [英] Replace regexp capture-group in Notepad++?

查看:57
本文介绍了在 Notepad++ 中替换正则表达式捕获组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Quick question: I have a regexp, ^(?:\b[A-Z]+\b\s+)+(.*)\d{8}, that gives two capture groups. I would like to replace capture group 1 with a whitespace. Is that possible?

如果我确实替换为:\1 它会替换 TEST TESTER 你好,世界.这里再说一句.75793250 -> 与 Hello, world.另一个词在这里.我想要这个结果:TEST TESTER 75793250.用空格替换 \1.

If I do replace with: \1 it replaces TEST TESTER Hello, world. Another word here. 75793250 -> with Hello, world. Another word here. I want this result: TEST TESTER 75793250. Replacing the \1 with a whitespace.

推荐答案

尝试使用:

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

并替换为:

\1\2

这篇关于在 Notepad++ 中替换正则表达式捕获组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆