List Info

Thread: Regex expression for blank subject




Regex expression for blank subject
country flaguser name
United States
2007-08-01 11:03:04
Hi All,

Is there a Regex expression that I can insert into a spam
filter to
block emails with either a blank subject or with a blank
body?

Thanks,
Terry


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---


Re: Regex expression for blank subject
country flaguser name
United States
2007-08-03 12:59:15
Hi Terry,

Jeffrey Friedl gives this example in his book
"Mastering Regular
Expressions"

while ($line = <>) {
if ($line =~ m/^s*$/ ) { # if we have an empty line . . .
last; # this immediately ends the 'while' loop.
}
if ($line =~ m/^Subject: (.*)/) {
$subject = $1;
}
if ($line =~ m/^Date: (.*)/) {
$date = $1;
}
if ($line =~ m/^Reply-To: (S+)/) {
$reply_address = $1;
}
if ($line -- m/^From: (S+) (([^()]*))/) {
$replyaddress = $1;
$from_name = $2;
}
}

For your needs, you will need to run a check to make sure
that
$subject would not be blank.
I am not sure what the body of the mail looks like since you
have not
quoted an example, but the same technique (as for the
subject), could
be used to filter out blank bodies as well.

Thanks
Syd

On Aug 1, 9:03 pm, tbrothers <terry.broth...gmail.com> wrote:
> Hi All,
>
> Is there a Regex expression that I can insert into a
spam filter to
> block emails with either a blank subject or with a
blank body?
>
> Thanks,
> Terry


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )