[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Regex to match lines with a specific number of words
From: |
Thibaut Verron |
Subject: |
Re: Regex to match lines with a specific number of words |
Date: |
Sat, 23 Apr 2022 23:46:14 +0200 |
No problem! The information is in the manual, but hidden behind several
layers of redirection.
I find the emacswiki page on regular expressions both more synthetic and
more informative.
Regarding performances, that's a bit strange.
Is it better if you add ^ and $ around the expression? Or if you add only ^
and search for exactly 30 repetitions (not 30 or more)?
Best wishes,
Thibaut
Le sam. 23 avr. 2022 à 23:34, Joost Kremers <joostkremers@fastmail.fm> a
écrit :
>
> On Sat, Apr 23 2022, Thibaut Verron wrote:
> > The group [:space:] also matches newline characters. So your search has
> > exactly one match, spanning many lines.
> > You can use [:blank:] instead to match spaces and tabs only, for the
> > separator.
>
> Thanks! I never would have thought of that. (Why isn't this mentioned
> explicitly
> in the manual?)
>
> Unfortunately, passing this regexp to `flush-lines` or
> `kill-matching-lines` in
> a file of close to 65000 lines completely cripples Emacs... One CPU core
> runs up
> to 100% and Emacs becomes unresponsive.
>
> Lemme see if a function that goes through the buffer, splits every line on
> white
> space and deletes those that are too long works better.
>
> Thanks, though, for the quick reply!
>
>
>
> --
> Joost Kremers
> Life has its moments
>
Re: Regex to match lines with a specific number of words, Nick Dokos, 2022/04/26