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

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

Re: Using re-builder


From: Michael Slass
Subject: Re: Using re-builder
Date: Thu, 17 Jun 2004 22:51:09 GMT
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

address@hidden (Phil_C) writes:

>When I copy a regex to the kill ring and then try to use it in
>something like "Query replace regex", I have to delete the extra "'s
>and \'s before it will work. Is there a way to copy it from re-builder
>without having to do that?


Try this:

(defun reb-copy-unquoted ()
  "Copy current RE into the kill ring for later insertion as unquoted."
  (interactive)
  (reb-update-regexp)
  (let ((re (with-temp-buffer
              (insert (reb-target-binding reb-regexp))
              (replace-string "\\\\" "\\" nil (point-min) (point-max))
              (buffer-substring (point-min) (point-max)))))
    (kill-new re)
    (message "Regexp copied to kill-ring")))

-- 
Mike Slass


reply via email to

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