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

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

Matching newlines in M-x rgrep?


From: PierGianLuca
Subject: Matching newlines in M-x rgrep?
Date: Tue, 25 Jul 2023 09:36:47 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

Hi everyone,

I'm trying to do a regexp search across some files using M-x rgrep. The pattern 
contains a newline. With isearch-forward-regexp I would use

\$\$\(.\|^J\)*?\$\$

where "^J" is entered via quoting (C-q).

When I use this search string with M-x rgrep, however, I get the following 
error:

find -H . -type d [...] -exec grep --color=auto -i -nH --null -e 
\\\$\\\$\\\(.\\\|'
'\\\)\*\?\\\$\\\$ \{\} +
grep: Unmatched ( or \(
grep: Unmatched ) or \)

I believe it's simply because the shell's grep uses a slightly different regexp format 
(or am I wrong?). Searching for solutions online seems to suggest modifying how Emacs 
calls rgrep, possibly adding "-P" to it. So I tried to customize the 
grep-command variable, but I'm not getting anywhere.

Any suggestions, in general, on how to match a newline in M-x rgrep?

I'm on a Linux system.

Cheers!
Luca



reply via email to

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