Gnus development mailing list
 help / color / mirror / Atom feed
* nnimap-split-methods syntax
@ 2010-12-06 19:02 Tommy Kelly
  2010-12-06 21:13 ` Tommy Kelly
  0 siblings, 1 reply; 7+ messages in thread
From: Tommy Kelly @ 2010-12-06 19:02 UTC (permalink / raw)
  To: ding

I'm trying to get to grips with the syntax for splitting. Following the
info example, one of my nnimap-split-methods is:

  ("0_to-me" "^From:.*verilab.com\\&^To:.*tommy.kelly@verilab.com")

The intention is that I split into group 0_to-me all mails that are from
domain "verilab.com" AND that have me in the To: header. However, it's
not matching on numerous emails that satisfy that condition. I suspect
my "\\&" has eomthing to do with it, but I've based it on the similar OR
condition -- "\\|" -- which I have working in other methods.

Have I written it wrong? 

thanks,
Tommy




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: nnimap-split-methods syntax
  2010-12-06 19:02 nnimap-split-methods syntax Tommy Kelly
@ 2010-12-06 21:13 ` Tommy Kelly
  2010-12-06 23:08   ` Andreas Schwab
  0 siblings, 1 reply; 7+ messages in thread
From: Tommy Kelly @ 2010-12-06 21:13 UTC (permalink / raw)
  To: ding

Tommy Kelly <tommy.kelly@verilab.com> writes:

>   ("0_to-me" "^From:.*verilab.com\\&^To:.*tommy.kelly@verilab.com")
> ...
> Have I written it wrong? 

Yeah, clearly (having begun reading regexp stuff) this is bonkers. I tried:

("0_to-me" "^From:.*verilab.com.*^To:.*tommy.kelly@verilab.com")

But I then learned that "." doesn't match LF or CR. So presumably the regexp
itself isn't the way to go, since I can't be sure how many CR or LF
characters lie between the From and the To. (In fact, can I even know
that the From precedes the To?) 

So what would be a good way if doing this kind of ANDed split method?
For example, is there a way of "nesting" the split methods the way I
could do in a sieve script?
 
Tommy




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: nnimap-split-methods syntax
  2010-12-06 21:13 ` Tommy Kelly
@ 2010-12-06 23:08   ` Andreas Schwab
  2010-12-07 19:38     ` Tommy Kelly
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2010-12-06 23:08 UTC (permalink / raw)
  To: Tommy Kelly; +Cc: ding

Tommy Kelly <tommy.kelly@verilab.com> writes:

> Yeah, clearly (having begun reading regexp stuff) this is bonkers. I tried:
>
> ("0_to-me" "^From:.*verilab.com.*^To:.*tommy.kelly@verilab.com")
>
> But I then learned that "." doesn't match LF or CR.

You can use "\\(.\\|\n\\)" to match really everything.  But another
problem with the regexp is that ^ is only special at the beginning of a
(sub-)regexp (use "\n" to match newline in the middle).

> For example, is there a way of "nesting" the split methods the way I
> could do in a sieve script?

Try out fancy splitting.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: nnimap-split-methods syntax
  2010-12-06 23:08   ` Andreas Schwab
@ 2010-12-07 19:38     ` Tommy Kelly
  2010-12-07 20:49       ` Andreas Schwab
  0 siblings, 1 reply; 7+ messages in thread
From: Tommy Kelly @ 2010-12-07 19:38 UTC (permalink / raw)
  To: ding

Andreas Schwab <schwab@linux-m68k.org> writes:

> Tommy Kelly <tommy.kelly@verilab.com> writes:
>
>> Yeah, clearly (having begun reading regexp stuff) this is bonkers. I tried:
>>
>> ("0_to-me" "^From:.*verilab.com.*^To:.*tommy.kelly@verilab.com")
>>
>> But I then learned that "." doesn't match LF or CR.
>
> You can use "\\(.\\|\n\\)" to match really everything.

Thanks Andreas. And you're probably right that I need to dive into fancy
splitting. But sticking with the simple approach for a while -- and
taking your suggestion -- suppose I have a header block containing the
following: 

From: Andreas Schwab <schwab@linux-m68k.org>
Subject: Re: nnimap-split-methods syntax
Newsgroups: gmane.emacs.gnus.general
To: Tommy Kelly <tommy.kelly@verilab.com>

Any ideas why doesn't it match on this:

("andreas-etc_to_me" "^From:.*linux-m68k.org\\(.\\|\n\\)*To:.*tommy.kelly@verilab.com")

thanks,
Tommy

P.S. I'am aware -- given your explanation concerning the action of ^ --
that it could also match in the obscure case where the "To: ..."
sequence wasn't anchored at the start of a line (e.g. if it was in a
Subject). But still, I don't see why I don't get a match despite that.





  But another
> problem with the regexp is that ^ is only special at the beginning of a
> (sub-)regexp (use "\n" to match newline in the middle).
>
>> For example, is there a way of "nesting" the split methods the way I
>> could do in a sieve script?
>
> Try out fancy splitting.
>
> Andreas.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: nnimap-split-methods syntax
  2010-12-07 19:38     ` Tommy Kelly
@ 2010-12-07 20:49       ` Andreas Schwab
  2010-12-07 21:36         ` Tommy Kelly
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2010-12-07 20:49 UTC (permalink / raw)
  To: Tommy Kelly; +Cc: ding

Tommy Kelly <tommy.kelly@verilab.com> writes:

> From: Andreas Schwab <schwab@linux-m68k.org>
> Subject: Re: nnimap-split-methods syntax
> Newsgroups: gmane.emacs.gnus.general
> To: Tommy Kelly <tommy.kelly@verilab.com>
>
> Any ideas why doesn't it match on this:
>
> ("andreas-etc_to_me" "^From:.*linux-m68k.org\\(.\\|\n\\)*To:.*tommy.kelly@verilab.com")

Dunno, it does for me.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: nnimap-split-methods syntax
  2010-12-07 20:49       ` Andreas Schwab
@ 2010-12-07 21:36         ` Tommy Kelly
  2010-12-08 18:13           ` Alberto Luaces
  0 siblings, 1 reply; 7+ messages in thread
From: Tommy Kelly @ 2010-12-07 21:36 UTC (permalink / raw)
  To: ding; +Cc: info-gnus-english

[Moving to .gnus.user -- didn't realize I may be bugging people on
the development list] 

I'm looking for some help in creating nnimap-split-methods that match on
more than one line. For example, I'd like to split out messages that are
From certain people AND To me.

I know I may need to try fancy splitting, but I'm now trying to
understand why certain regex's don't do what I expect. For example, I
tried a split something of the (imperfect) form:

("to-me-from-certain-people" "^From:.*certainpeople.com\\(.\\|\n\\)*To:.*tommy.kelly@verilab.com")

But it doesn't work. Even more confusingly, it does work for someone
else (on the developer list).

Can anyone suggest what the problem is? 
What's the best way to debug this kind of thing? (I'm using nnimap, so
I'm not sure nnmail-split-history is useful -- I can't find an
nnimap-split-history). 

thanks,
Tommy




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: nnimap-split-methods syntax
  2010-12-07 21:36         ` Tommy Kelly
@ 2010-12-08 18:13           ` Alberto Luaces
  0 siblings, 0 replies; 7+ messages in thread
From: Alberto Luaces @ 2010-12-08 18:13 UTC (permalink / raw)
  To: ding; +Cc: info-gnus-english

Tommy Kelly writes:

> [Moving to .gnus.user -- didn't realize I may be bugging people on
> the development list] 
>
> I'm looking for some help in creating nnimap-split-methods that match on
> more than one line. For example, I'd like to split out messages that are
> From certain people AND To me.
>
> I know I may need to try fancy splitting, but I'm now trying to
> understand why certain regex's don't do what I expect. For example, I
> tried a split something of the (imperfect) form:
>
> ("to-me-from-certain-people" "^From:.*certainpeople.com\\(.\\|\n\\)*To:.*tommy.kelly@verilab.com")
>
> But it doesn't work. Even more confusingly, it does work for someone
> else (on the developer list).
>
> Can anyone suggest what the problem is? 
> What's the best way to debug this kind of thing? (I'm using nnimap, so
> I'm not sure nnmail-split-history is useful -- I can't find an
> nnimap-split-history). 

You can find useful the regexp-builder mode when applied to some of your
mails, in order to see if your regex is correct. `C-u g', that is
`gnus-summary-show-article' called with an argument, can show you also
the raw mail for you to test.

-- 
Alberto




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-12-08 18:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-06 19:02 nnimap-split-methods syntax Tommy Kelly
2010-12-06 21:13 ` Tommy Kelly
2010-12-06 23:08   ` Andreas Schwab
2010-12-07 19:38     ` Tommy Kelly
2010-12-07 20:49       ` Andreas Schwab
2010-12-07 21:36         ` Tommy Kelly
2010-12-08 18:13           ` Alberto Luaces

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