Emacs, scripting and anything text oriented.

How to change upper case to lower via search/replace?

Kaushal Modi

This posts explain how the emacs in-built query-replace-regexp command can be used to convert upper-cased strings to lower case.

  • Do M-x query-replace-regexp or use the default binding C-M-% to activate the regular expression search/replace.
  • Enter the regexp for the strings to be replaced in the *Query regexp:” field. For instance, if I want to convert I_data and Q_data to i_data and q_data respectively, then my search regular expression will be \([IQ]\)_data.
  • It is important to use the escaped grouping brackets \( and \) to wrap an expression that you want to upcase or downcase.
  • In the next Query replace: prompt, the expression will be \,(downcase \1)_data1.

  1. Use \,(upcase \REGEXGROUPNUMBER) to convert to upper case instead. [return]

If you have written a response to this, enter your response post's URL below.

Or, you can send a "comment" webmention (it's OK if you don't know what that means). When asked about your website on an IndieAuth login screen, simply type https://commentpara.de.

Markdown Support**bold**, _italics_, ~~strikethrough~~, [descr](link), `monospace`, ```LANG\nline1\nline2\n``` (Yep, multi-line code blocks too, with syntax highlighting!), auto-hyperlinking.

Webmentions #