here are my procmail recipes:
:0
* ^Subject: [JIRA] (EDRV-*) *$
.JIRA.edrive/new
:0
* ^Subject: [SPAM] *$
.SPAM/new
:0
* ^X-Spam-Status: Yes
.SPAM/new
:0
* .*
new
I want to put my messages with [JIRA] (EDRV-XXX) in the subject into the JIRA/edrive folder of the mailbox and messages marked with [SPAM] in the subject – into the SPAM folder.
But what I am getting now:
procmail: [8652] Sat Aug 27 19:08:19 2016
procmail: Assigning "SHELL=/bin/bash"
procmail: No match on "^Subject: [JIRA] (EDRV-*) *$"
procmail: No match on "^Subject: [SPAM] *$"
procmail: No match on "^X-Spam-Status: Yes"
procmail: Match on ".*"
procmail: Assigning "LASTFOLDER=new/msg.qVktB"
procmail: Opening "new/msg.qVktB"
procmail: Acquiring kernel-lock
Subject: [JIRA] (EDRV-100) xxxxxxx
Folder: new/msg.qVktB><------><------><------><------><------><------> 2795
Where is a mistake?
Best Answer
This is a very basic regex error. In order to match
[
or(
literally, you have to escape them with a backslash.The same applies to any regex metacharacter -
.
,*
,|
, etc.Also, to match unconditionally, simply don't put any conditions.
I'm guessing you didn't really mean to only allow whitespace after the matches, so I took those out, too. If you wanted to say "anything", that's
.*
in regex, but there is no point in having a condition whitch matches anything.