Go to the first, previous, next, last section, table of contents.


Replace Commands and Case

If the arguments to a replace command are in lower case, it preserves case when it makes a replacement. Thus, the command

M-x replace-string RET foo RET bar RET

replaces a lower case `foo' with a lower case `bar', an all-caps `FOO' with `BAR', and a capitalized `Foo' with `Bar'. (These three alternatives--lower case, all caps, and capitalized, are the only ones that replace-string can distinguish.)

If upper-case letters are used in the second argument, they remain upper case every time that argument is inserted. If upper-case letters are used in the first argument, the second argument is always substituted exactly as given, with no case conversion. Likewise, if the variable case-replace is set to nil, replacement is done without case conversion. If case-fold-search is set to nil, case is significant in matching occurrences of `foo' to replace; this also inhibits case conversion of the replacement string.


Go to the first, previous, next, last section, table of contents.