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

From: jathd <[email-masked]>
Date: Sat, 02 Feb 2013 20:02:30 +0100

Lars Ingebrigtsen <[email-masked]> writes:

> 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.

I have `nnmail-split-fancy-match-partial-words' set to `nil', and I
checked that the splitting process does put a "\\<" in the regexp.

The problem is that this regexp is used to decide whether a message
follows a rule (in other words, that regexp is matched against the
message header), but when extracting the value with which to replace
"\\1" in the group name "list.devel.\\1" I gave, it matches a second
time with the *original regexp* I gave (and not the whole header this
time, it narrows the search to the interesting part of the relevant
header field). So this time, it uses the regexp without the "\\<", which
explains why it replaces "\\1" with "s" instead of "batteries".

So there's a simple workaround: I just put a "\\<" in the regexp in
`nnmail-split-fancy', and it works fine. So I don't know if this is a
bug or not; the workaround is simple, but I still find the behaviour of
the matcher a bit unexpected. Namely, I would expect it to match as if
using `(string-match regexp-I-gave contents-of-relevant-header-field)'.
Maybe the manual should have a word about this?

-- 
jathd