在 vi 编辑器中进行搜索和替换时,如何转义正斜杠(/),使其被正确识别,比如在文件路径中。
例如:/Users/tom/documents/pdfs/
:%s//Users/tom/documents/pdfs//<new text>/g --FAILS (obviously)
:%s/\/Users/tom/documents/pdfs\//<new text>/g -- FAILS with a trailing error
:%s/'/Users/tom/documents/pdfs/'/<new text>/g -- FAILS with a trailing error
我错过了什么?