help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: case change in replacement text with regex-replace


From: Dieter Wilhelm
Subject: Re: case change in replacement text with regex-replace
Date: Mon, 16 Apr 2007 01:10:46 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.95 (gnu/linux)

Le TeXnicien de Surface <texnicien.de.surface@chezmoi.eur> writes:

> I know I will obtain a string of two characters (the capturing regexp is in
> fact immaterial) and what I would like to obtain from, say, AB is the
> string `AB ab Ab aB' as previously stated. I could even easily capture two
> strings of one character each. So, in a nutshell: How do we change the case
> of a character, previously captured, in the replacement string? Is there
> anything as the perl \U to be used in the replacement part of a

\U I didn't see in the elisp manual

> regex-search and replace?

I'd try it with the \, command with replace-regexp though

(info "(emacs) Regexp Replace") <- put cursor behind parenthesis and
type C-x C-e.  The following is just an idea, I didn't check it.  I
assume you must also make the search and replace command case
sensitive.

IDEA: \(.\)\(.\) -> \,(concat (upcase \1)(downcase \2) " " (...))


-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany




reply via email to

[Prev in Thread] Current Thread [Next in Thread]