On , I learnt ...
That Vim can transform replacement values when substituting
Vim supports a range of special patterns that can transform the replacement value when performing a search and replace.
For example, inserting
\U will make all following characters upper case (until
the pattern ends of
\E is encountered). So running:
:%s/name = "\(.*\)"/upper_case_name = "\U\1"/g
name = "Alan" name = "Barry" name = "Callum"
will result in:
upper_case_name = "ALAN" upper_case_name = "BARRY" upper_case_name = "CALLUM"
Some useful transformations to be aware of:
\u: Next character made upper case.
\U: Following characters made upper case (until
\l: Next character made lower case.
\L: Following characters made lower case (until