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

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

Re: Regex to match lines with a specific number of words


From: Joost Kremers
Subject: Re: Regex to match lines with a specific number of words
Date: Sun, 24 Apr 2022 16:31:56 +0200
User-agent: mu4e 1.6.10; emacs 28.1.50

On Sat, Apr 23 2022, Stefan Monnier via Users list for the GNU Emacs text 
editor wrote:
>>> \([^[:space:]]+[[:space:]]+\)\{30,\}
>
> I don't think yo want to match more than 30 times: as soon as you have
> 30 repetitions you know what to do.

True. I modelled it on a regex for SublimeText, which, however, was used in a
search and replace operation (where the replacement string was empty), so
matching more than 30 times was necessary. But for flush-lines it's not.

[...]
> Personally, I'd go with something like:
>
>     ^\([^\n\t ]+[\t ]+\)\{30\}

Thanks, I'll try that and see if it gives any speed advantages.


-- 
Joost Kremers
Life has its moments



reply via email to

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