Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using gVIM on XP

How can I convert the left side of this file to lowercase while keeping right side unchanged?

%s/**what goes here?**/g

CONVERTTOLOWERCASE###Keep CaSe
AAAA###AeiOu
BBBB###qWerTy

Desired Results

converttolowercase###Keep CaSe
aaaa###AeiOu
bbbb###qWerTy
share|improve this question
up vote 1 down vote accepted

Here is the command you are looking for:

%s/^[^#]\+/\=toupper(submatch(0))/

See:

  • :help tolower()
  • :help sub-replace-special
  • :help sub-replace-expression
  • :help submatch()
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .