The description of the problem is rather obscure, so I will give an example directly
There is a file like this
A1 A2 A3
hopes to be replaced with
F1B1 F2B2 F3B3How should
be written?
仅有的幸福2017-05-16 16:44:43
vim’s regular expressions are quite special, see http://vimregex.com/, but it supports back references, but you need to use escaped brackets (
和 )
,然后在替换部分依序引用(如, 1
).
:%s:A\(\d\+\):FB:g