Is it possible to use vim to replace the 'http://google.com/' and other links to '#'?
<a class="link1" href="http://google.com/">My Link</a>
<a class="link1" href="http://yahoo.com/">My Link</a>
<a href="http://stackoverflow.com/">My Link</a>
to
<a class="link1" href="#">My Link</a>
<a class="link1" href="#">My Link</a>
<a href="#">My Link</a>
Thanks
This one should handle the basic http case:
:%s/http:\/\/[^\"]*/#/g
But this should be more flexible - the general idea is to find instances of href=", save that as a group, then match until we hit another ". Then we replace it with our group (\1) and the hash sign:
:%s/\(href=\"\)[^\"]*/\1#/g
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With