[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: force upper case of matched regex text pattern
From: |
Niels Giesen |
Subject: |
Re: force upper case of matched regex text pattern |
Date: |
Thu, 13 Mar 2008 18:42:31 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
"xahlee@gmail.com" <xahlee@gmail.com> writes:
> is there a way to force to upper case of a matched regex text pattern?
>
C-M-% your_regexp RET \,(upcase \num_of_match)
> (i recall having seen it somewhere)
>
> Currently, what i'm doing is to write my own replacement function that
> change the case like this:
>
> (defun upcase-matched ()
> "Returns the upcase of matched text."
> (let (m1 returnText)
> (setq m1 (upcase (buffer-substring (match-beginning 1) (match-end
> 1))))
> (setq returnText (concat "<p>" m1 ))
> returnText
> )
> )
>
> then use “\,(upcase-matched)” for the replacement text.
so:
C-M-% your_regexp RET \,(upcase <p>\0)
...for instance
>
> PS I wrote a tutorial on this
>
> http://xahlee.org/emacs/emacs_find_replace.html
please rewrite it, because as you see, you can refer to (sub)matches in the
\,() environment ;)
>
> Xah
> xah@xahlee.org
> ∑ http://xahlee.org/
>
> ☄
--
http://niels.kicks-ass.org