all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: torys.anderson@gmail.com (Tory S. Anderson)
To: Michael Albinus <michael.albinus@gmx.de>
Cc: help-gnu-emacs@gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Thanks! Re: cleaning up a big regexp
Date: Mon, 15 Sep 2014 10:42:33 -0400	[thread overview]
Message-ID: <871trduequ.fsf_-_@gmail.com> (raw)
In-Reply-To: <87tx49dldt.fsf@gmx.de> (Michael Albinus's message of "Mon, 15 Sep 2014 16:11:10 +0200")

Okay. In my code I now have: 
(setq my-gnus-bulk-from-address-list '("@maillist.codeproject.com"
				      "@papajohns-specials.com"
				      "@qomail.quikorder.com"
				      "@linkedin.com"
				      "@facebookmail.com"
				      "@plus.google.com"
				      "@twitter.com"
				      "@youtube.com"
				      "@linguistlist.org"
				      "@sportsauthority.com")) ;; list of bulkmail addresses
(setq my-bulk-from (mapconcat (lambda (x) (concat "^From:.*" x)) my-gnus-bulk-from-address-list "\\|"))

(setq nnmail-split-methods
       '(("mail.bulk" my-bulk-from)


Looks much better and seems to work. It appends "From:.*" to each string and then combines them into a single string. Any suggestions for improvement are welcome; big thanks for the suggestions that helped me figure this out. regexp-opt will probably make this more efficient (especially for big lists), but I haven't figured out how to plug it in yet. 


Michael Albinus <michael.albinus@gmx.de> writes:

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>>> (mapconcat `regexp-quote my-gnus-bulk-from-address-list "\\|"))
>>
>> A.k.a (regexp-opt my-gnus-bulk-from-address-list)
>
> Not when the strings contain meta characters like "*". I repeat it again
> and again, because I've entered this trap very recently. See commit
> trunk r117880, where I refuse to tell that I have been an idiot.
>
>> -- Stefan
>
> Best regards, Michael.



  reply	other threads:[~2014-09-15 14:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.8887.1410779723.1147.help-gnu-emacs@gnu.org>
2014-09-15 11:18 ` cleaning up a big regexp Joost Kremers
2014-09-15 11:26   ` Tory S. Anderson
2014-09-15 11:41   ` Michael Albinus
2014-09-15 12:06     ` Tory S. Anderson
2014-09-15 12:18       ` Michael Albinus
2014-09-15 12:36       ` Stefan Monnier
2014-09-15 14:11         ` Michael Albinus
2014-09-15 14:42           ` Tory S. Anderson [this message]
2014-09-15 19:00           ` Stefan Monnier
2014-09-16 11:05             ` Regexp in nnmail-split-methods (was Re: cleaning up a big regexp) Tory S. Anderson
     [not found]             ` <mailman.8968.1410865533.1147.help-gnu-emacs@gnu.org>
2014-09-16 12:33               ` sokobania.01
2014-09-17 21:20                 ` RESOLVED " Tory S. Anderson

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=871trduequ.fsf_-_@gmail.com \
    --to=torys.anderson@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=michael.albinus@gmx.de \
    --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.