|Tue 1998-08-25 Gregory Sutter <gsutter(_at_)pobox(_dot_)com> list.procmail
|
| > Maintainability should be paramount.
|
| I have a case where, as an action for every recipe in a large set, I
| set a variable and call an includerc. The includerc line never changes
| and I wanted to keep it compact and clear. Here's an example, also
| showing Philip Guenther's Message-Id rule, which has been in demand
| lately:
|
| # Phil Guenther's Message-Id: rule
| :0
| * ()^Message-Id:\/.*
| * ! ^Message-Id:[ ]*<[ ]*("([^"\]|\\.)*"|[-!#-'*+/-9=?A-Z^-~]+)\
| ([ ]*\.[ ]*("([^"\]|\\.)*"|[-!#-'*+/-9=?A-Z^-~]+))*\
| [ ]*(_at_)[ ]*\
| (\[[ ]*([^][\]|\\.)*[ ]*\]|\
| [-!#-'*+/-9=?A-Z^-~]+([ ]*\.[ ]*[-!#-'*+/-9=?A-Z^-~]+)*)\
| [ ]*>
| { JFMATCH="$JFSEC: Bad Message-Id: $MATCH" INCLUDERC=$JFDIR/junkfilter.match }
Philip :-) Wouldn't you like to think in terms of abstraction, my eyes
hurt if I ever had to deal with maintenance tasks of this kind of code.
I would do:
var1 = "(...)"
var2 = "(...)"
var3 = "(...)"
regexp = "$var$var2+var1?$var3*"
*$ $regexp.*Other.*maybe.*$var1.*and
You know...
jari