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

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

Thanks! Re: cleaning up a big regexp


From: Tory S. Anderson
Subject: Thanks! Re: cleaning up a big regexp
Date: Mon, 15 Sep 2014 10:42:33 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

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 via email to

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