[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "\":Converting "dired-do-rename-regexp" into a "query-replace"?
From: |
Andreas Röhler |
Subject: |
Re: "\":Converting "dired-do-rename-regexp" into a "query-replace"? |
Date: |
Sat, 30 Jan 2010 17:46:45 +0100 |
User-agent: |
Thunderbird 2.0.0.19 (X11/20081227) |
David Combs wrote:
> Subj: "\\":Converting "dired-do-rename-regexp" into a "query-replace"?
>
> I need to turn this:
>
> (dired-do-rename-regexp
> "Lendman_1_\\([0-9][0-9]\\)\\([0-9][0-9]\\)\\([0-9][0-9]\\)_100000.mp3"
> "\\3\\1\\2-S.L.mp3")
>
> into:
>
> (query-replace-regexp "FROMPAT" "TO-STRING" nil (if (and
> transient-mark-mode mark-active) (region-beginning)) (if (and
> transient-mark-mode mark-active) (region-end)))
>
Hi,
didn't check your forms limiting the search, assuming it works,
IIUC your question, use:
(while
(query-replace-regexp YOUR-FIRST-REGEXP (if (and transient-mark-mode
mark-active) (region-beginning)) (if (and transient-mark-mode
mark-active) (region-end)) t 1)
(replace-match (concat (match-string-no-properties 3)
(match-string-no-properties 1) (match-string-no-properties 2) "-S.L.mp3")))
HTH
Andreas
--
https://code.launchpad.net/s-x-emacs-werkstatt/
>
> (the dired one works fine; now I want to adjust the regexps, but test them in
> an ascii file, not as file-names in dired.)
>
> So, once I did that, how to convert it BACK into the dired-form>?
>
> Thanks!
>
> David
>
>
>
>