Wikia

Vim Tips Wiki

Quote unquoted HTML attributes

Talk0
1,613pages on
this wiki
Revision as of 05:24, August 11, 2011 by JohnBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Tip 662 Printable Monobook Previous Next

created 2004 · complexity basic · author James Childers · version 6.0


This is a simple regex that can be used to search an HTML file and replace all unquoted attributes with their quoted version.

map <F9> :%s/\([^&^?]\)\(\<[[:alnum:]-]\{-}\)=\([[:alnum:]-#%]\+\)/\1\2="\3"/g<CR>

CommentsEdit

I use this regex and abbreviate it to "reg1".

cabbrev reg1 %s/=\([^"][^> ]\{0,40\}\)/="\1"/gc

Around Wikia's network

Random Wiki