Nicole Lallande wrote:
> How do I change the case of all html tags in a file from uppercase to
> lowercase? BTW, is there an archive for this list - I hate to think I
> am asking a question that has been asked a zillion times before. (My
> apologies if this is one of those questions.)
According to http://www.vim.org/mail.html#archives
the archive for
this list is http://www.yahoogroups.com/list/vim
I think that
will do what you want. Explanation:
:% Apply what follows to each line in the file
s/pattern/replace/flags Substitute pattern with replace; the "g" flag
means everywhere in the line, not just the
/<[^>]*>/ matches a "<" followed by any number of non-">" character,
followed by a ">"
/\L&/ & refers to the whole match and \L means convert it to lower case
This will not handle all cases. For example, it will miss HTML tags that
span more than one line. When it does work, it will make everything
between "<" and ">" lower case, including 'href="CaseSensitiveFileName"'.
It might be safer to use /<[^ \t>]*/ for the pattern: a "<" character,
followed by as many non-space, non-tab, non-">" characters as possible.
HTH --Benji Fisher