in message <000501c24b02$40ef5640$a2acf880(_at_)OYUPC1>,
wrote Shashank Khanvilkar thusly...
Hi,
Problem description.
I need to filter mails based on the "Subject:". The subject can contain
varios lines as below:
1. Subject: [paper] This is a test paper.
2. Subject: [url] this is a test URL
3. Subject: [thought] this is a test thought.
:0:
* ^Subject:.*\[(.*)\](.*)
IN-$1
(I know there is no $1 in procmail..
similar-but-not-quite procmail variable is $MATCH.
use "\/" to extract the matched pattern on right hand side into
$MATCH. then use that for any further manipulation. note that
a match is non-greedy.
below is the untested recipe. if it spits out error "invalid
regex", then escape the "]" inside "[^]]".
:0
* ^Subject:[ ]*\[\/[^]]\]
{
:0:
* MATCH ?? ()[^]]
IN-${MATCH}
}
in the "* Subject:", first $MATCH is set to text matched by
"[^]]\]". later, the last ']' is removed by matching only "[^]]".
you may want to exert little more control on the unknown inside
'[..]' by replacing "[^]]" w/, say, "[a-z0-9]".
- parv
--
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail