🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
4 messages
4 total messages Started by Roy DeRousse Sun, 03 Jan 1999 00:00
Attack of the Killer Articles pt. 2: Need help with regular expression
#45663
Author: Roy DeRousse
Date: Sun, 03 Jan 1999 00:00
36 lines
2066 bytes
Some of you may remember a problem I discovered last month.  Gravity 
chokes on certain SPAM articles when it tries to decode them.  They cause 
the program to crash.  My only solution has been to add them to the bozo 
bin.  Recently, the number of these Killer Articles (KA) has increased 
dramatically, and it is a real pain to 1) add a subject to the bozo bin,  
2) restart the decoding, 3) crash, and 4) keep repeating the cycle.  I 
would like to make a general purpose rule to kill these KAs before they 
kill me!

Fortunately, the spammers are consistent with their subjects.  Here is an 
example:

  io7y   S E E  M Y  G I R L F R I E N D

They start off with some gibberish, followed by some spaces, followed by 
a double-spaced subject in caps.  I want to create a regular expression 
that does this:  "Mark article as read if subject contains a capital 
letter, followed by a space, followed by a capital letter, followed by 
two spaces, followed by a capital letter, followed by a space, followed 
by a capital letter."  I am having trouble creating such an expression.  
Here is onen of my attempts:

  Subject contains reg. expr. "[A-Z][ ][A-Z][ ][ ][A-Z][ ][A-Z]"

It didn't find any matches.

Can anyone help me with this?  Please?!  I would be forever in your debt.

-- 
Have fun!

Roy DeRousse (relayer@iname.com)
St. Louis, Missouri, USA


Re: Gravity: Attack of the Killer Articles pt. 2: Need help with regular expression
#45660
Author: Roy DeRousse
Date: Sun, 03 Jan 1999 00:00
48 lines
2807 bytes
Thanks for the replies, Tom and Greg.  I probably wouldn't have even 
looked at my note since it didn't have Gravity in the header (d'oh!).  

Tom, your reply gave me the clue that I needed.  Like you, I test my 
rules manually first.  Why did it work for you and not for me, then?  The 
answer is that I was looking for the wrong thing!  The article heading 
didn't look _exactly_ as it's quoted below.  There are actually multiple 
spaces before and after "M Y."  They just looked like double spaces in 
Gravity.  Upon realizing this, I came up with this rule:

  Subject contains reg. expr. "[A-Z][ ][A-Z][ ]{2,}[A-Z][ ][A-Z]"

... and it works great!  Thanks again!

In article <MPG.10f95847890147d2989851@news.naplesfl.net>, 
nfn03862@naples.net says...
> Roy DeRousse posted ...
> > Fortunately, the spammers are consistent with their subjects.  Here is an 
> > example:
> > 
> >   io7y   S E E  M Y  G I R L F R I E N D
> > 
> > They start off with some gibberish, followed by some spaces, followed by 
> > a double-spaced subject in caps.  I want to create a regular expression 
> > that does this:  "Mark article as read if subject contains a capital 
> > letter, followed by a space, followed by a capital letter, followed by 
> > two spaces, followed by a capital letter, followed by a space, followed 
> > by a capital letter."  I am having trouble creating such an expression.  
> > Here is onen of my attempts:
> > 
> >   Subject contains reg. expr. "[A-Z][ ][A-Z][ ][ ][A-Z][ ][A-Z]"
> > 
> > It didn't find any matches.
> 
> When I entered your reg exp in a rule and tried on a test post it 
> worked for me. Have you tried to test it first? I usually set the 
> rule action to tag the article and fire it manually before I use it. 
> That way I can what it hits. If it works you may need to check that 
> you have a rule action selected and that it is enabled for incoming.

-- 
Have fun!

Roy DeRousse (relayer@iname.com)
St. Louis, Missouri, USA


Re: Attack of the Killer Articles pt. 2: Need help with regular expression
#45661
Author: Greg Berigan
Date: Sun, 03 Jan 1999 00:00
62 lines
3671 bytes
In article <MPG.10f8e9c6277485ec989750@news.earthlink.net>,
relayer@iname.com (Roy DeRousse) wrote:

> Some of you may remember a problem I discovered last month.  Gravity 
> chokes on certain SPAM articles when it tries to decode them.  They cause 
> the program to crash.  My only solution has been to add them to the bozo 
> bin.  Recently, the number of these Killer Articles (KA) has increased 
> dramatically, and it is a real pain to 1) add a subject to the bozo bin,  
> 2) restart the decoding, 3) crash, and 4) keep repeating the cycle.  I 
> would like to make a general purpose rule to kill these KAs before they 
> kill me!
> 
> Fortunately, the spammers are consistent with their subjects.  Here is an 
> example:
> 
>   io7y   S E E  M Y  G I R L F R I E N D
> 
> They start off with some gibberish, followed by some spaces, followed by 
> a double-spaced subject in caps.  I want to create a regular expression 
> that does this:  "Mark article as read if subject contains a capital 
> letter, followed by a space, followed by a capital letter, followed by 
> two spaces, followed by a capital letter, followed by a space, followed 
> by a capital letter."  I am having trouble creating such an expression.  
> Here is onen of my attempts:
> 
>   Subject contains reg. expr. "[A-Z][ ][A-Z][ ][ ][A-Z][ ][A-Z]"
> 
> It didn't find any matches.

Because it doesn't match.  You want something like:

    .*([A-Z] +)+.*

This matches anything which has at least one instance of patterns of
single capital letters followed by one or more spaces.  If you want to be
more specific:

    [a-z0-9]* +([A-Z] +)+.*

That will match the gibberish followed by one or more spaces followed by a
present pattern of capital letters followed by spaces.

There may be other equivalent regular expressions that your software can
evaluate faster than these.  You may want to tailor them further to
require at least three instances of the pattern so it doesn't match anyone
you uses a single letter capital letter anywhere in their subject.

If you can, use another newsreader that doesn't crash and capture all the
headers of an offending article.  (A DejaNews reference would help, but an
actual copy is better since DejaNews doesn't disclose all headers.) 
Gravity shouldn't crash on bizarre input, but the input needs inspection. 
It may be possible to tailor a killfile entry on something other than the
subject which would target these problem articles directly, such as on
Message-ID or References.

-- 
         ,=<#)-=#  <http://incolor.inetnebr.com/wotw/> (The War of the Worlds)
    ,_--//--_,
 _-~_-(####)-_~-_  "Did you see that Parkins boy's body in the tunnels?" "Just
(#>_--'~--~`--_<#)  the photos.  Worst thing I've ever seen; kid had no face."

Re: Attack of the Killer Articles pt. 2: Need help with regular expression
#45664
Author: Tom B.
Date: Sun, 03 Jan 1999 00:00
45 lines
2327 bytes
Roy DeRousse posted ...

 
> Fortunately, the spammers are consistent with their subjects.  Here is an 
> example:
> 
>   io7y   S E E  M Y  G I R L F R I E N D
> 
> They start off with some gibberish, followed by some spaces, followed by 
> a double-spaced subject in caps.  I want to create a regular expression 
> that does this:  "Mark article as read if subject contains a capital 
> letter, followed by a space, followed by a capital letter, followed by 
> two spaces, followed by a capital letter, followed by a space, followed 
> by a capital letter."  I am having trouble creating such an expression.  
> Here is onen of my attempts:
> 
>   Subject contains reg. expr. "[A-Z][ ][A-Z][ ][ ][A-Z][ ][A-Z]"
> 
> It didn't find any matches.

When I entered your reg exp in a rule and tried on a test post it 
worked for me. Have you tried to test it first? I usually set the 
rule action to tag the article and fire it manually before I use it. 
That way I can what it hits. If it works you may need to check that 
you have a rule action selected and that it is enabled for incoming.

I usually like to test a rule more thoroughly before I post but I 
also tried these which seemed to work, the first is yours just 
modified slightly to hit exactly 2 spaces.

Subject contains reg. expr. "[A-Z][ ][A-Z][ ]{2}[A-Z][ ][A-Z]"
Subject contains reg. expr. "[A-Z]{1} {1}[A-Z]{1} {2}[A-Z]{1} {1}[A-
Z]{1}"

I didn't test these too much, email me if they don't work or need 
refined. If you email me include a newsgroup name where I can test 
it better.

Happy New Year
-- 

     Tom B.   NAPLES, FL
     nfn03862@naples.net

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads