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

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

Re: How to grep for a string spanning multiple lines?


From: Jean Louis
Subject: Re: How to grep for a string spanning multiple lines?
Date: Sun, 27 Nov 2022 10:26:11 +0300
User-agent: Mutt/2.2.7+37 (a90f69b) (2022-09-02)

(re-search-forward "friend.*\n.*while")

* Marcin Borkowski <mbork@mbork.pl> [2022-11-27 09:56]:
> On 2022-11-26, at 15:55, Emanuel Berg <incal@dataswamp.org> wrote:
> 
> > Marcin Borkowski wrote:
> >
> >> I remember that someone in some video said something, and
> >> I want to find that part. However, it turns out that it is
> >> split between two (or more) lines.
> >
> > (re-search-forward ";; Hello my friend\n;; stay a while, and listen")
> >
> > ;; Hello my friend
> > ;; stay a while, and listen
> 
> Well, that's obviously cheating.  The real problem is how to search when
> you have no idea where you have spaces and where you have
> newlines...

Problem is so much less when using regular expressions, see above.


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

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