OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Subject: Re: regexp filter question
From: Michael Tokarev (mjttls.msk.ru)
Date: Sat Nov 04 2000 - 13:02:50 CST


Admin Mailing Lists wrote:
>
> Hi,
>
> I'm trying to create a Subject: line filter in header_restricts with a
> regexp. The filter should reject a line containing at least 5 spaces,
> surrounded by text. It should not reject a subject line that is all
> spaces.
>
> I tried: /^Subject: [^ ]([^ ]*) ( *)[^ ]([^ ]*)/ REJECT
>
> which seemed to work in prelim. testing, but later on seemed to let
> through subjects that had a space in the text before the 5 spaces, i.e.
> "Subject: this is a test test"
>
> can anyone tell me, give me a regexp line to do what i described?

/^subject:.*[^ ] *[^ ]/ REJECT

Or (you may need to place backslashes before `{' and `}'),

/^subject:.*[^ ] {5,}[^ ]/ REJECT

Or, using PCRE,

/^subject:.*\S\s{5,}\S/ REJECT

(not quite this, since \s = [ \t\n\r], \S = [^\s])

Regards,
 Michael.