all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* regexp-quote for replacements
@ 2004-09-12 18:13 Roland Winkler
  2004-09-13 16:17 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Roland Winkler @ 2004-09-12 18:13 UTC (permalink / raw)



I want to construct replacement patterns automatically.
Does the following piece of code insert the value of bar in the
replacement, no matter what the string bar is?
The point is that I want the optional arg LITERAL of replace-match
to be nil.

(let* ((foo "foo")
       ;; this string should appear in the replacement
       (bar "bar.\\")
       ;; the following is like regexp-quote for replacements?
       (baz (replace-regexp-in-string "\\\\" "\\\\" bar nil t)))
  (string-match "\\(foo\\)" foo)
  (replace-match (concat "\\1 " baz " \\1") nil nil foo))


Thanks a lot,

Roland

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

end of thread, other threads:[~2004-09-13 16:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-12 18:13 regexp-quote for replacements Roland Winkler
2004-09-13 16:17 ` Stefan Monnier

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.