Strip <span> tags from HTML in vim

When upgrading a website you might see source code like this:

<span style="font-family: Arial; color: #0000ff; font-size: small;">Some text goes here</span>

You’re using CSS now and all those <span> tags are ruining it. In gvim, do this search and substitute:

%s/<span.\{-}>//g

Then to get rid of the </span> tags, do this:

:%s/<\/span>//g

Share:
  • del.icio.us
  • Facebook
  • Google
  • E-mail this story to a friend!
  • Technorati
  • TwitThis

Leave a Reply