all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Joost Kremers <joostkremers@fastmail.fm>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Regex to match lines with a specific number of words
Date: Sun, 24 Apr 2022 16:31:56 +0200	[thread overview]
Message-ID: <87ee1mo8cu.fsf@fastmail.fm> (raw)
In-Reply-To: <jwvk0bf1kx2.fsf-monnier+emacs@gnu.org>


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	other threads:[~2022-04-24 14:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-23 19:44 Regex to match lines with a specific number of words Joost Kremers
2022-04-23 20:58 ` Thibaut Verron
2022-04-23 21:20   ` Joost Kremers
2022-04-23 21:46     ` Thibaut Verron
2022-04-23 22:11       ` [External] : " Drew Adams
2022-04-23 22:32         ` Thibaut Verron
2022-04-23 22:21       ` Joost Kremers
2022-04-23 22:46   ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-04-24 14:31     ` Joost Kremers [this message]
2022-04-26 23:55 ` Nick Dokos
2022-04-27  7:23   ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ee1mo8cu.fsf@fastmail.fm \
    --to=joostkremers@fastmail.fm \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.