4 ms·
I'd think something like: :%s/word1\(.*\)word2$/word3\1word4/ Over each line in the whole file, search for word 1 and word 2 (which is at the end of the file)
by khedoros1 10y ago
I'd think something like:
:%s/word1\(.*\)word2$/word3\1word4/
Over each line in the whole file, search for word 1 and word 2 (which is at the end of the file), separated by arbitrary non-newline characters, and change them to word3 and word4.
- juki 10y agoThe Emacs equivalent would be M-x replace-regexp word1\(.*\)word2$ RET word3\1word4 RET Assuming you have `replace-regexp` bound to a key, it's practically the same. Works on the whole buffer (by default), or the region (if selected).