On Friday, October 17, 2003, at 09:19 AM, Michael Weber wrote:

Greetings!

Howdy.


I am attempting to parse emails on the fly after a spam filter adds a score to the headers. (SpamAssassin, if you're curious.)

When I try to find out what the spam score is I am getting a weird error. Here's the lines that error out:

if ( $msg[$line] =~ '^X-Spam-Level: ***********' ) {

if ($msg[$line] =~ /^X-Spam-Level: [*]+/) {


or

$bad_spam += length $1 if $msg[$line] =~ /^X-Spam-Level: ([*]+)/;

If you want to increase the count by the number of *s.

                        $bad_spam += 1;
                }

The score is the number of splats. The more splats, the higher the spam score.

The error I am getting is:

Nested quantifiers before HERE mark in regex m/^X-Spam-Level: ** << HERE *********/ at /home/filter/grab.pl line 16.

Why am I getting a HERE marker? Do I need to escape all the "*"s? Do I need to do something else?

* is a regex metacharacter. Escaping all the *s would do the trick, yes, as does putting it in a character class.


I am looking for the string "X-Spam-Level: " followed by 11 or more splats. If I find it, I need to modify another line in the @msg array (the subject line) and forward the message on.

Oops, I should have read down to here first, eh? <laughs>


if ($msg[$line] =~ /^X-Spam-Level: \*{11,}/) {
        # has 11 or more *s...
}

Hope that helps.

James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to