Emacs: When regexp query-replacing in a `find-name-dired` results buffer, how to match the newline character?

254 Views Asked by At

I know how to use C-q C-j or C-o in the query string when doing a query-replace or a query-replace-regex, and that works great.

However, in find-name-dired, after I've toggled to select the pertinent files in the *Find* buffer, if I then type Q and try to use either of those (or several other experiments that also don't work) as the query string, no strings ever match my query, even though I know they're there.

This could be a bug. But, since this behavior has been the same for a couple decades, it's likely there's something I'm missing. (Before, I'd always do the find-with-newline/replace file-by-file, but today I need to change too many files for that to be practical.)

Alternatively, if anybody knows of a better way in Emacs to perform a regex replace across many files at once than find-name-dired, I'm all ears ...

1

There are 1 best solutions below

2
choroba On

Note that the documentation of dired-do-find-regexp-and-replace which is invoked by Q ends with

REGEXP should use constructs supported by your local ‘grep’ command.

grep can't match multiline patterns.