How to change upper case to lower via search/replace?
— Kaushal ModiThis 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-regexpor use the default bindingC-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_dataandQ_datatoi_dataandq_datarespectively, 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.
Use
\,(upcase \REGEXGROUPNUMBER)to convert to upper case instead. ↩︎