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


i'm trying find instances of twitter handle, , wrap anchor tag around them.

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

which gives me:

e488: trailing characters 

when separator character (/ in case) between {pattern} , {string} contained in 1 of those, must escaped \. trick avoid use different separator character, e.g. #:

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

ps: if should think should do, pattern wrong; see correction.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -