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

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

Re: Using re-builder


From: Phil_C
Subject: Re: Using re-builder
Date: 18 Jun 2004 07:35:43 -0700

Michael Slass <address@hidden> wrote in message news:<address@hidden>...
> 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")))

Thanks, that just about does it - except the beginning and ending
quotes are still there. Still, that's much better than it was before,
since now I don't have to go through the whole regex deleting "\"s.


Thanks again,

--Phil


reply via email to

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