On Mon, 2022-04-04 at 00:13 +0200, Matija Nalis wrote:
> On Sun, Apr 03, 2022 at 10:06:51AM +0100, Niamh Holding wrote:
> > Hello Matija,
> > Saturday, April 2, 2022, 7:12:42 PM, you wrote:
> >
> > MN> grep -r check_rbl_sub /var/lib/spamassassin
> > MN> for examples of what's possible and how (e.g. 25_dnswl.cf)
> >
> > Looking there I see nothing equivalent to alternates like in
> > ordinary regexes (2|6) for 2 or 6
>
> It shows how command must look to be able to correctly use regexes
> there (instead of plain string).
>
> "grep" command above should've returned more examples for you...
>
Using 'grep -P ' is better because it forces grep to use Perl regex
notation - SA is written in Perl so uses Perl regular expression (regex)
syntax.
If you want to write your own SA rules its also a good idea to have a
copy of the 'Camel Book' ("Programing PERL" by Wall, Christiansen and
Orwant, pub. O'Reilly) because SA is written in Perl. his means it uses
the Perl dialect of regex expressions, and the book will also help a lot
if/when you want to write your own SA plugins.
For instance, I whitelist any email sender who I've previously sent mail
to. To do this I maintain am email archive held in a PostgreSQLÂ
database and wrote an SA plugin that searches the archive for any
message(s) I've previously sent to the sender of the message being
checked: if I've sent mail to them they get whitelisted.
> Then you can use similar principle to look for any other things you
> want to accomplish in the future, simply by looking how others have
> used it. That's why I provided it that way instead of simple
> copy/pasting the
> final result.
>
Good advice.
Martin