Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* [patch] Greedy pattern in nnmail-split-it eats too much
@ 2004-01-06 21:57 Dmitry Astapov
  0 siblings, 0 replies; only message in thread
From: Dmitry Astapov @ 2004-01-06 21:57 UTC (permalink / raw)



Well, since No Gnus has started new development series, I'd like to repost
my suggestion from way back. Hope that it could be implemented now.

Subject: Topics

Topics:
   [patch] Greedy pattern in nnmail-split-it
   Re: [patch] Greedy pattern in nnmail-split-it

----------

From: Dmitry Astapov <adept@ukr.net>
Subject: [patch] Greedy pattern in nnmail-split-it
Date: Wed, 28 May 2003 13:00:36 +0300


Hi!

I have a clause in nnmail-split-fancy which auto-creates folders for mail
from my colleagues. It looks like this:

(from "\\b\\(\\w+\\)@umc.com.ua"
                (: (lambda (subexpr_no)
                     (downcase
                      (concat "mail.umc."
                              (replace-in-string
                               (match-string subexpr_no)
                               "[. ]" "_"))))
                   1))

However, I found out that for addresses like "Name.Department@umc.com.ua" the
matched substring is "Department". And I want it to be "Name".

I tried to rewrite regexp this way: "\\b\\([^.]+\\).*@umc.com.ua", but
nothing changed. Tried removing "\\b" or replacing it with "\\<", but
things only got worth, up to matching only last letter from "Department" in
case when neither "\\b" nor "\\<" was prepended.

It turned out that cause for my troubles lie in nnmail-split-it:
[snip]
        (setq regexp (concat "^\\(\\("
			     (if (symbolp field)
				 (cdr (assq field nnmail-split-abbrev-alist))
			       field)
			     "\\):.*\\)"
			     (or partial-front "\\<")
			     "\\("
			     value
			     "\\)"
			     (or partial-rear "\\>")))
[snip]


Here greedy match is used to glue together regexp for FIELD and regexp for
VALUE, and this greedy match eats too much. Basically, it prevents user
from using non-greedy matches at the beginning of VALUE in the
nnmail-split-fancy at all.

I propose to change ":.*" to ":.*?"


-- 
Dmitry Astapov //ADEpt                               E-mail: adept@ukr.net
GPG KeyID/fprint: F5D7639D/CA36 E6C4 815D 434D 0498  2B08 7867 4860 F5D7 639D

----------

From: Lars Magne Ingebrigtsen <larsi@gnus.org>
Subject: Re: [patch] Greedy pattern in nnmail-split-it
Date: Sat, 07 Jun 2003 19:51:41 +0200

Dmitry Astapov <adept@ukr.net> writes:

> Here greedy match is used to glue together regexp for FIELD and regexp for
> VALUE, and this greedy match eats too much. Basically, it prevents user
> from using non-greedy matches at the beginning of VALUE in the
> nnmail-split-fancy at all.
>
> I propose to change ":.*" to ":.*?"

Well, this can't be changed in the stable Gnus series, so could you
suggest this again once the next development series starts?

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen

----------


-- 
Dmitry Astapov //ADEpt
GPG KeyID/fprint: F5D7639D/CA36 E6C4 815D 434D 0498  2B08 7867 4860 F5D7 639D


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-01-06 21:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-06 21:57 [patch] Greedy pattern in nnmail-split-it eats too much Dmitry Astapov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).