unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: David Kastrup <dak@gnu.org>
Subject: Re: Emacs replace-regexp
Date: 26 Jul 2004 13:06:58 +0200	[thread overview]
Message-ID: <x53c3f3u3x.fsf@lola.goethe.zz> (raw)
In-Reply-To: mailman.1504.1090839233.1960.help-gnu-emacs@gnu.org

Andreas Madsack <andreas.madsack@web.de> 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

  parent reply	other threads:[~2004-07-26 11:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-26 10:35 Emacs replace-regexp Thomas Ruschival
2004-07-26 10:48 ` David Kastrup
2004-07-26 10:50 ` Andreas Madsack
     [not found] ` <mailman.1504.1090839233.1960.help-gnu-emacs@gnu.org>
2004-07-26 11:06   ` David Kastrup [this message]
     [not found] <mailman.1511.1090842897.1960.help-gnu-emacs@gnu.org>
2004-07-26 12:26 ` David Kastrup

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=x53c3f3u3x.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).