Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
快速提问:我有一个正则表达式,^(?:\b[A-Z]+\b\s+)+(.*)\d{8}它提供了两个捕获组。我想用空格替换捕获组 1。那可能吗?
^(?:\b[A-Z]+\b\s+)+(.*)\d{8}
如果我替换为:\1它会替换TEST TESTER Hello, world. Another word here. 75793250-> 为Hello, world. Another word here. 我想要这个结果:TEST TESTER 75793250。\1用空格替换。
\1
TEST TESTER Hello, world. Another word here. 75793250
Hello, world. Another word here
TEST TESTER 75793250
尝试使用:
^((?:\b[A-Z]+\b\s+)+)(?:.*)(\d{8})
并替换为:
\1\2
这样做:
正则表达式:^(\b[A-Z]+\b\s+)+(?:.*)(\d{8})
^(\b[A-Z]+\b\s+)+(?:.*)(\d{8})
用。。。来代替:\1 \2
\1 \2