My Vim replace with a regex is throwing a `E488: Trailing characters`

When the separator character (/ in your case) between {pattern} and {string} is contained in one of those, it must be escaped with a \. A trick to avoid that is to use a different separator character, e.g. #:

:%s#@\(\w\+\)#<a href="http://www.twitter.com/\1">\0</a>#gc

PS: If it should do what I think it should do, your pattern is wrong; see my correctio

Leave a Comment