On 04/15/2010 04:26 AM, Jürgen Krämer wrote:
I would like to apply a built-in func on a backreference in one shot
substitute command.

%s/<description>\(\w\+\)</description>/\=<description>tolower(\1)</
description>/

   %s/<description>\(\w\+\)</description>/\='<description>' . tolower(submatch(1)) 
.'</description>'/

While Jürgen answers your general question, for your particular example, you may also want to know about the \l \L \u \U \e tokens in a replacement:

  %s/<description>\zs\w\+\ze<\/description>/\L&/g

or


%s@<description>\(\w\+\)</description>@<description>\L&\e</description>@g

(don't forget to escape the "/" in the closing tag unless you use alternate delimiters like "@" in trhe 2nd example)

You can read about them at

  :help s/\u

-tim










--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

To unsubscribe, reply using "remove me" as the subject.

Reply via email to