My text is written in paragraphs that are split into lines, which makes it difficult to search for strings that might be spanned across several lines. For instance, given the following text
This is an example
of a text.
when searching for the string "example of" in an unmodified emacs version it finds no occurrences. However, if I add the following customization, which was suggested in another post on the emacs stack exchange, the search works as desired:
(setq isearch-lax-whitespace t)
(setq isearch-regexp-lax-whitespace t)
(setq search-whitespace-regexp "[ \t\r\n]+")
My question is how to configure the query-replace operation (M-%) so that it will behave as my modified search operation, i.e., be able to find and replace strings, while ignoring white spaces.