Re: regexp help
On Thu, Jan 23, 2003 at 02:09:28PM -0500, Dave W wrote:
> I'm using animail and spamassassin on my mail now, with -some- success
> on spam, but need help with animail's ~/.animail/filter file. It can be
> filled with regexps for mail blocking, but I'm a regexp newbie and can't
> find how the heck to do an "and" in a regexp. "or" is easy, but _is_
> there an "and" function for regexps?
Depends on how you look at it -- "and" simply means a whole RE;
e.g. /x|y|z/ matches either x, y or z, whereas /xys/ matches an
x that is followed by y that is in turn followed by z. There you
have it: it must match x, y, _and_ z, in that order. Consider
this: /x.*y.*z/.
>
> Right now my filter file is simple, like this:
>
> ^Subject:.*custom.*website
> ^Subject:.*celeb*
> ^From:.*discount
> ^Subject:.*discount
> ^From:.*cbc@notrix.net
> ^Subject:.*laudable.*project
> /viagra/
> /penis/
[Which made my script almost think you were a spammer 8-)]
>
> ...but I'd like to be able to block subject lines or bodies that have,
> say, 'celeb' and 'sex' in any order.
What about this little trick: "/celeb.*sex|sex.*celeb/"?
andrej
--
echo ${girl_name} > /etc/dumpdates
Reply to: