[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to grep for a string spanning multiple lines?
From: |
Arthur Miller |
Subject: |
Re: How to grep for a string spanning multiple lines? |
Date: |
Sat, 26 Nov 2022 11:57:43 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (windows-nt) |
Marcin Borkowski <mbork@mbork.pl> writes:
> Hi all,
>
> assume I have a file (probably an Org mode one) with some stuff
> I archived from the 'net. (I'm going to start to sue
> youtube-sub-extractor.el.) Here is my problem: assume 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.
>
> Traditional `grep' is not helpful in this situation. Neither is
> isearch, nor swiper. One idea would be to convert the subtitles to one
> long line (which is an option), but are there any other ways to search
> for a string spanning more than one line (and not knowing which words
> are separated by a space and which ones by a newline)?
>
> Both Emacs-y and shell-y tools would be appreciated.
>
> TIA,
If your plans are to use regex search & friends in Emacs Lisp, then
matching over multiple lines can be a bit tricky. Out of the box,
without trixing with syntax tables (which I am not familiar with), ".*"
will match only to the end of the line. You can use ".*\\(\n.*\\)*".
I have learned it from the Wiki page:
https://www.emacswiki.org/emacs/MultilineRegexp . I don't know if you
are aware of it already or not, hope it helps.
- How to grep for a string spanning multiple lines?, Marcin Borkowski, 2022/11/26
- Re: How to grep for a string spanning multiple lines?, Jean Louis, 2022/11/26
- Re: How to grep for a string spanning multiple lines?, tomas, 2022/11/26
- Re: How to grep for a string spanning multiple lines?, Jean Louis, 2022/11/26
- Re: How to grep for a string spanning multiple lines?, Eli Zaretskii, 2022/11/26
- Re: How to grep for a string spanning multiple lines?, Jean Louis, 2022/11/26
- Re: How to grep for a string spanning multiple lines?, Michael Heerdegen, 2022/11/27
- Re: How to grep for a string spanning multiple lines?, Jean Louis, 2022/11/27
- Re: How to grep for a string spanning multiple lines?, Michael Heerdegen, 2022/11/27
- Re: How to grep for a string spanning multiple lines?, Jean Louis, 2022/11/27
Re: How to grep for a string spanning multiple lines?,
Arthur Miller <=
Re: How to grep for a string spanning multiple lines?, Emanuel Berg, 2022/11/26
- Re: How to grep for a string spanning multiple lines?, Marcin Borkowski, 2022/11/27
- Re: How to grep for a string spanning multiple lines?, Jean Louis, 2022/11/27
- Re: How to grep for a string spanning multiple lines?, Emanuel Berg, 2022/11/27
- Re: How to grep for a string spanning multiple lines?, tomas, 2022/11/27
- RE: [External] : Re: How to grep for a string spanning multiple lines?, Drew Adams, 2022/11/27
- Re: [External] : Re: How to grep for a string spanning multiple lines?, address@hidden, 2022/11/28
- RE: [External] : Re: How to grep for a string spanning multiple lines?, Drew Adams, 2022/11/28
- Re: [External] : Re: How to grep for a string spanning multiple lines?, Emanuel Berg, 2022/11/30
- Re: [External] : Re: How to grep for a string spanning multiple lines?, Stefan Monnier, 2022/11/28