2

Dired has the interactive function dired-do-find-regexp-and-replace which can be match based on the regexp you have passed and perform the replace.

But I'm looking for non regex variant of dired-do-find-regexp-and-replace where I don't have to pass the regexp. Is something like that available for dired ? I'm okay with using additional dired based packages for it, if they provide the non-regexp version of the function.

  • Please be more specific, if possible with an example. How it's supposed to match something you don't pass? – Muihlinn Jun 4 at 10:52
  • @Muihlinn I can see how the question is confusing. I have edited it. Does that make it better ? – Sibi Jun 4 at 10:54
  • Pass a literal string as regexp, you'll just have to look for chars that can match a regexp operator. – Muihlinn Jun 4 at 11:08
  • @Muihlinn But my literal string has regex characters in it (and I don't want to escape them). – Sibi Jun 4 at 11:23
  • 1
    Both Q&A look good to me. Searching for "regexp-quote" doesn't suggest that the question is a duplicate or that answers elsewhere involving regexp-quote are relevant here. – Drew Jun 4 at 15:43
2

Use dired-do-find-regexp-and-replace but making use of regexp-quote to match only the literal string of its argument. This way you'll use the quoted regexp only as search string, without touching the original.

(dired-do-find-regexp-and-replace (regexp-quote from) to)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.