Subject: bug#12375: Broken matching of regexps in fancy splitting

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 25 Dec 2012 16:13:03 +0100

jathd <[email-masked]> writes:

> I'm not sure if this counts as a bug, but it's certainly an unexpected
> behaviour (to me) to which I have found no reference in the manual.
>
> The situation:
>
>  * In .gnus.el, specify splitting with
>
>        (setq nnmail-split-methods 'nnmail-split-fancy)
>        (setq nnmail-split-fancy
>              '(to "\\(\\w+\\)-devel@.*" "list.devel.\\1"))
>
>  * Visit a message whose only relevant header (relative to the "to"
>    abbreviation) is
>
>        To: Batteries-devel <[email-masked]>
>
>  * Press B q and read the message in the minibuffer.
>
> Current message: This message would go to list.devel.s
> Expected message: This message would go to list.devel.batteries
>
> I believe the problem comes from the way the regexp value I gave (the
> VALUE field in the split) is matched against the contents of the header,
> as defined in the function nnmail-split-it in nnmail.el. Once the
> interesting bit of the header has been found, the match is done with
> re-search-backward, which explains why the "\\w+" bit only matches the
> last letter of "batteries".

Do you have `nnmail-split-fancy-match-partial-words' set?  If not, the
splitting machinery will put a \\< in front of the regexp, leading to
"batteries" being matched.

-- 
(domestic pets only, the antidote for overdose, milk.)
  http://lars.ingebrigtsen.no  *  Lars Magne Ingebrigtsen