[imapfilter-devel] trouble with matching regular expressions

Jared redjar at redjar.org
Thu Dec 6 18:43:36 EET 2007


Hello,

I'm having trouble getting regular expression matching working with  
imapfilter.  I installed imapfilter from the deb package on a Ubuntu  
Gutsy (7.10) machine.  I saw on the mailing list that this version was  
broken, so I replaced the common.lua and mailbox.lua files from this  
post:
http://lists.hellug.gr/pipermail/imapfilter-devel/2007/000752.html

Testing things out, a simple rule using "contain_subject" works fine.   
However, if I then change the rule to use "match_subject", and a  
simple regular expression, it doesn't seem to match.  Any pointers to  
what I'm missing is appreciated.

I have a few test messages in a folder called, "test".  One of which  
has the subject, "the quick brown fox jumps over the lazy dog".  I'm  
using the regex: '.*brown.*' and trying to move the matched message to  
a folder called, "test2".

config file and debug out is below.

Thanks,
-jared

------------------------
config.lua contents

---------------
--  Options  --
---------------

options.timeout = 120
options.subscribe = true
options.starttls = true

----------------
--  Accounts  --
----------------

-- My Account
account1 = IMAP {
     server = 'myserver.example.com',
     username = 'my_username',
     password = 'my_password',
     port = 993,
     ssl = 'ssl3',
}

result = account1.test:match_subject('.*brown.*')
account1.test:move_messages(account1['test2'], result)

---------------------
Verbose output

S (4): * OK myserver IMAP4rev1 server ready.
C (4): 1000 NOOP
S (4): 1000 OK NOOP completed
C (4): 1001 CAPABILITY
S (4): 1001 OK CAPABILITY completed
C (4): 1002 LOGIN "my_username" *
S (4): 1002 OK Login completed
C (4): 1003 SELECT "test"
S (4): 1003 OK [READ-WRITE] SELECT completed
C (4): 1004 UID SEARCH ALL
S (4): 1004 OK UID SEARCH completed
C (4): 1005 UID FETCH 1 BODY.PEEK[HEADER.FIELDS (Subject)]
S (4): 1005 OK FETCH completed
C (4): 1006 UID FETCH 2 BODY.PEEK[HEADER.FIELDS (Subject)]
S (4): 1006 OK FETCH completed
C (4): 1007 UID FETCH 3 BODY.PEEK[HEADER.FIELDS (Subject)]
S (4): 1007 OK FETCH completed
C (4): 1008 UID FETCH 4 BODY.PEEK[HEADER.FIELDS (Subject)]
S (4): 1008 OK FETCH completed
C (4): 1009 UID FETCH 5 BODY.PEEK[HEADER.FIELDS (Subject)]
S (4): 1009 OK FETCH completed
C (4): 100A LOGOUT
S (4): 100A OK Logout completed

-------------------------
Debug file contents

getting response (4):

* OK myserver IMAP4rev1 server ready.

sending command (4):

1000 NOOP

getting response (4):

1000 OK NOOP completed

sending command (4):

1001 CAPABILITY

getting response (4):

* CAPABILITY IMAP4rev1 IDLE UIDPLUS
1001 OK CAPABILITY completed

sending command (4):

1002 LOGIN "my_username" *

getting response (4):

1002 OK Login completed

sending command (4):

1003 SELECT "test"

getting response (4):

* FLAGS (\Answered \Flagged \Deleted \Draft \Seen)
* 5 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 1196597960] UID validity status
* OK [UIDNEXT 22] Predicted next UID
* OK [PERMANENTFLAGS (\* \Answered \Flagged \Deleted \Draft \Seen)]  
Permanent flags
1003 OK [READ-WRITE] SELECT completed

sending command (4):

1004 UID SEARCH ALL

getting response (4):

* SEARCH 14 17 18 19 21
1004 OK UID SEARCH completed

sending command (4):

1005 UID FETCH 1 BODY.PEEK[HEADER.FIELDS (Subject)]

getting response (4):

1005 OK FETCH completed

sending command (4):

1006 UID FETCH 2 BODY.PEEK[HEADER.FIELDS (Subject)]

getting response (4):

1006 OK FETCH completed

sending command (4):

1007 UID FETCH 3 BODY.PEEK[HEADER.FIELDS (Subject)]

getting response (4):

1007 OK FETCH completed

sending command (4):

1008 UID FETCH 4 BODY.PEEK[HEADER.FIELDS (Subject)]

getting response (4):

1008 OK FETCH completed

sending command (4):

1009 UID FETCH 5 BODY.PEEK[HEADER.FIELDS (Subject)]

getting response (4):

1009 OK FETCH completed

sending command (4):

100A LOGOUT

getting response (4):

* BYE IMAP4rev1 server logging out
100A OK Logout completed


-------------------------




More information about the Imapfilter-devel mailing list