all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Emacs replace-regexp
@ 2004-07-26 10:35 Thomas Ruschival
  2004-07-26 10:48 ` David Kastrup
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Thomas Ruschival @ 2004-07-26 10:35 UTC (permalink / raw)


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.

Please help me out
Thomas Ruschival

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Emacs replace-regexp
  2004-07-26 10:35 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>
  2 siblings, 0 replies; 5+ messages in thread
From: David Kastrup @ 2004-07-26 10:48 UTC (permalink / raw)


Thomas Ruschival <t.ruschival@vivid-md.de> writes:

> 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.

You could try reading the documentation in the Emacs manual.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Emacs replace-regexp
  2004-07-26 10:35 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>
  2 siblings, 0 replies; 5+ messages in thread
From: Andreas Madsack @ 2004-07-26 10:50 UTC (permalink / raw)


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]

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

-- 
<>< Andreas Madsack
PGP/GnuPG key: 1024D/FD6A8D9D

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Emacs replace-regexp
       [not found] ` <mailman.1504.1090839233.1960.help-gnu-emacs@gnu.org>
@ 2004-07-26 11:06   ` David Kastrup
  0 siblings, 0 replies; 5+ messages in thread
From: David Kastrup @ 2004-07-26 11:06 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Emacs replace-regexp
       [not found] <mailman.1511.1090842897.1960.help-gnu-emacs@gnu.org>
@ 2004-07-26 12:26 ` David Kastrup
  0 siblings, 0 replies; 5+ messages in thread
From: David Kastrup @ 2004-07-26 12:26 UTC (permalink / raw)


cweinberg@freenet.de writes:

> > for more help ...<br>
> <br>
> Better<br>
> <br>
> (info "(emacs)Regexp Replace")<br>
>                               ^ press C-x C-e here.<br>
> <br>
> <br>
> you are the unbearable great know-it-all. Aren't you?!
> 
> 
> <br>--<br><!-- AdSpace freenet EMO Webmail Banner --> 

If you have anything helpful to offer to the original question, your
answer would have benefitted from telling your mail agent not to send
HTML-formatted mail.

As it is, you complain about useful advice not given to you in a
useless and annoying way.  Please change your Mailreader to a
generally useful format.  This will let people react more favorably to
your postings even when you are doing nothing more than bitching.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-07-26 12:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1511.1090842897.1960.help-gnu-emacs@gnu.org>
2004-07-26 12:26 ` Emacs replace-regexp David Kastrup
2004-07-26 10:35 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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.