[H-GEN] Emacs Lisp and Regular Expressions

Jason Parker-Burlingham jasonp at uq.net.au
Tue Nov 26 08:39:57 EST 2002


[ Humbug *General* list - semi-serious discussions about Humbug and     ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]

john duncan <agley at austarmetro.com.au> writes:

>           I have been using Gnus for mail and news with a sorting rule
> like the one following,
> 
> (setq nnmail-split-methods
>       '(("humbug" "To:.*general at lists.humbug.org.au")
>         ("newbies" "To:.*openbsd-newbies at sfobug.org")
>         ("other" "")))
> 
>           The other day I saw an article which seemed to say that I
> should be escaping the dots in the domain names with double slashes.
>           Is this right?
> 
> http://www.linuxjournal.com/article.php?sid=6449

Yes and no.  To be strictly correct, you should escape the periods so
they match literally, otherwise they'll match any character (like the
dot before the star does).  To escape correctly in your .emacs or
.gnus, you'll usually need to use two slashes:

(setq nnmail-split-methods
      '(("humbug" "To:.*general at lists\\.humbug\\.org\\.au")
        ("newbies" "To:.*openbsd-newbies at sfobug\\.org")
        ("other" "")))

However, it's unlikely you'll see a an address that will match the
regexes without the quoted periods, so it's safe to leave them alone
and save the bother.

On the gripping hand, you shouldn't sort your mail by matching on the
"To:" header since that's notoriously hard to get right (find out what
happens when someone Cc:s or Bcc:s one of those lists).  Instead you
should match against some other header inserted into messages to the
list for that purpose:

	("mail.humbug" "^X-Loop:.*@lists.humbug.org.au")
	("mail.nflug" "^Sender: owner-nflug at nflug.org")
	("mail.efa-members" "^X-BeenThere: members at lists.efa.org.au")
	("mail.gvsage" "^Sender: owner-gvsage-sagelocal at usenix.org")

You'll notice I don't bother quoting the periods either.

Cheers,

jason
-- 
||----|---|------------|--|-------|------|-----------|-#---|-|--|------||
| ``I think I'm going to throw up.''                                    |
|                                             -- Kermit the Frog, Yambo |
||--|--------|--------------|----|-------------|------|---------|-----|-|

--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.  See http://www.humbug.org.au/



More information about the General mailing list