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

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

Re: Emacs replace-regexp


From: David Kastrup
Subject: Re: Emacs replace-regexp
Date: 26 Jul 2004 13:06:58 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Andreas Madsack <address@hidden> writes:

> Am Monday 26 July 2004 12:35 schrieb Thomas Ruschival:
> > Hi,
> > I guess I am too stupid to read the regexp syntax of Emacs I can't figure
> > out how to access parts of the match for replace like in perl or awk with
> > $1,$2....
> > I'd like to put brackets around the hyperlinks of a latex-document.
> > do I did a replace-regexp "(\ref\{.*\})" "\[$1\]"
> > and it doesn't do the trick. so I played a little while with the syntax and
> > all I got out were "$1" on each place where once was a hyperlink....hmmm.
> 
> In emacs-regex it's \1,\2,...
> 
> your latex-brackets problem: \(\ref{.*}\) -> [\1]

No.  If at all, \(\\ref{[^}]*}\) -> [\1]

But this is already too complicated. \\ref{[^}]*} -> [\&]

will do the trick.

> for more help on replace-regexp: C-h f replace-regexp

Better

(info "(emacs)Regexp Replace")
                              ^ press C-x C-e here.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


reply via email to

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