Word1 Word2 Word3 ... Wordx LastWord
Word1 Word2 Word3 ... Wordx LastWord
我怎么可能加上“|”在每行的最后一个单词之前,并在 vim 中使用 Regex 返回以下结果?
Word1 Word2 Word3 ... Wordx | LastWord
Word1 Word2 Word3 ... Wordx | LastWord
最佳答案
尝试以下命令
:%s/[^ ]*$/| &/
或者(由IngoKarkat 建议)
:%s/\S*$/| &/
关于regex - Vim 正则表达式 : Add character before the last word of each line,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20077765/