开发者

How do I replace this text in VIM?

开发者 https://www.devze.com 2023-03-28 08:09 出处:网络
:%s/oldword/newword/g That\'s how I usually do it. Now, I want to replace abc.com with <%= domain %>.How can I do that? (The symbols don\'t work when you type them in vim command line)
:%s/oldword/newword/g

That's how I usually do it. Now, I want to replace abc.com with <%= domain %>. How can I do that? (The symbols don't work when you type them in vim command line)

:%s/abc.com开发者_运维百科/<%= domain %>/g


You need to escape . (so that it does not match any character) and %. Try this:

:%s/abc\.com/<\%= domain \%>/g


You must escape the '.' and '%' characters. Like this :%s/abc\.com/<\%= domain \%>/g

0

精彩评论

暂无评论...
验证码 换一张
取 消