๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
10 messages
10 total messages Started by Ed Mon, 14 Apr 2008 19:02
Regex to detect long subject lines
#219242
Author: Ed
Date: Mon, 14 Apr 2008 19:02
11 lines
1652 bytes
I've been trying to come up with a regex that will trap overly long subject 
lines but honestly I'm terrible at regular expression syntax


I'd like to be able to trap any message with a subject line more than 60 
characters long

thx

-- 
http://blog.peculiarplace.com
Re: Regex to detect long subject lines
#219244
Author: Bert Hyman
Date: Mon, 14 Apr 2008 20:35
17 lines
1597 bytes
apostle@REMOVETHISpeculiar.homeip.net (Ed) wrote in
news:Xns9A808EE42A7682362352@127.0.0.1: 

> I'd like to be able to trap any message with a subject line more
> than 60 characters long

Never used them myself, but if your RE scanner supports "bounds", you
could do it. 

Something on the order of ".{61,}" would match 61 or more occurrences
of any character (or maybe 62; I don't know if the first character
counts). 

Probably not exactly what you want, but maybe close.

-- 
Bert Hyman | St. Paul, MN | bert@iphouse.com
Re: Regex to detect long subject lines
#219245
Author: Steve Hodgson
Date: Mon, 14 Apr 2008 20:37
23 lines
1951 bytes
On 2008-04-14 20:02:48 +0100, Ed <apostle@REMOVETHISpeculiar.homeip.net> said:

> I've been trying to come up with a regex that will trap overly long subject
> lines but honestly I'm terrible at regular expression syntax
> 
> I'd like to be able to trap any message with a subject line more than 60
> characters long

You could start with something like [a-zA-Z0-9;: ]{60,} which will find 
a subject line that includes the characters listed between the square 
brackets if it is at least 60 characters long. I thought letters, 
numbers, spaces and a couple of punctuation characters cover the 
majority of subject lines.

Hope this helps.
-- 
Cheers,

Steve

The reply-to email address is a spam trap.
Email steve 'at' shodgson 'dot' org 'dot' uk
Re: Regex to detect long subject lines
#219249
Author: Mike Dee
Date: Tue, 15 Apr 2008 00:44
43 lines
3089 bytes
Ed <apostle@REMOVETHISpeculiar.homeip.net> wrote:

> I've been trying to come up with a regex that will trap overly
> long subject lines but honestly I'm terrible at regular expression
> syntax 
 
>From the Xnews manual, under the section on Regular Expression:

3) Quantifiers (match how many times)

   *     Match 0 or more times
   +     Match 1 or more times
   ?     Match 1 or 0 time (i.e., optionally match)
   {n}   Match exactly n times
   {n,}  Match at least n times
   {n,m} Match at least n but not more than m times
 
> I'd like to be able to trap any message with a subject line more
> than 60 characters long

The following score, based on the above rules:

%%-----------------------------

[.]

    Score: -100
      Subject: .{60,}

%%-----------------------------

The above will do what you want.

I've given it a score of -100, you can use any number here from -9999 
to 9999

In the keyword line after "Subject", the period "." before the curly 
braces means match any character (inculdes spaces) and within the curly 
braces the comma and space after the number means "match at least n 
times". So this will match any subject of 60 or more characters.

-- 
dee
Re: Regex to detect long subject lines
#219251
Author: Mike Dee
Date: Tue, 15 Apr 2008 00:49
12 lines
2240 bytes
Mike Dee <emteedee@invalid.invalid> wrote:

>       Subject: .{60,}

[...]

> within the curly braces the comma and space after the number

Oops, no space there, just curl braces, number and a comma ;-)

-- 
dee
Re: Regex to detect long subject lines
#219253
Author: Blinky the Shark
Date: Tue, 15 Apr 2008 04:44
28 lines
2228 bytes
Mike Dee wrote:

> Ed <apostle@REMOVETHISpeculiar.homeip.net> wrote:
> 
>> I've been trying to come up with a regex that will trap overly long
>> subject lines but honestly I'm terrible at regular expression syntax
>  
> From the Xnews manual, under the section on Regular Expression:
> 
> 3) Quantifiers (match how many times)
> 
>    *     Match 0 or more times
>    +     Match 1 or more times
>    ?     Match 1 or 0 time (i.e., optionally match) {n}   Match exactly n
>    times
>    {n,}  Match at least n times
>    {n,m} Match at least n but not more than m times

I *think* that's PCRE; I dunno if that's coincidental (if I'm right)
because I dunno if Xnews is totally compatible.


-- 
Blinky
Killing all posts from Google Groups
The Usenet Improvement Project: http://improve-usenet.org
Blinky: http://blinkynet.net
Re: [Xnews] Regex to detect long subject lines
#219255
Author: Mike Dee
Date: Tue, 15 Apr 2008 06:48
48 lines
3689 bytes
Blinky the Shark <no.spam@box.invalid> wrote:

> Mike Dee wrote:
>   
>> From the Xnews manual, under the section on Regular Expression:
>> 
>> 3) Quantifiers (match how many times)
>> 
>>    *     Match 0 or more times
>>    +     Match 1 or more times
>>    ?     Match 1 or 0 time (i.e., optionally match) {n}   Match
>>    exactly n times
>>    {n,}  Match at least n times
>>    {n,m} Match at least n but not more than m times
> 
> I *think* that's PCRE; I dunno if that's coincidental (if I'm
> right) because I dunno if Xnews is totally compatible.

>From the Xnews manual:
----------------
Xnews uses Philip Hazel's PCRE (Perl Compatible Regular Expression) 
package, adapted for Delphi by yours truly.
----------------

So I would assume that Xnews's PCRE is compatible with Phillip Hazel's 
version of it (much of it being compatible with other PCRE out there, 
but there may be some variences and incompatibilities with say, SLRN 
and others).

However, the given quantifiers above are indentical to the PCRE at 
perl.com <http://www.perl.com/doc/manual/html/pod/perlre.html> under 
the sub-heading "The following standard quantifiers are recognized:".

The OP perhaps should've put Xnews/Hamster in the subject header too, 
as he was posting using Xnews over Hamster... perhaps he wanted this 
for Hamster and not Xnews, I dunno he wasn't clear on that. But if he's 
running Hamster he'll be bright enough to work it out I would guess.

Afterthought: The actual Xnews script I gave was "greedy", it would be 
less greedy with the addition of a trailing "?", as in:

[.]

    Score: -100
      Subject: .{60,}? 

-- 
dee
Re: [Xnews] Regex to detect long subject lines
#219302
Author: Blinky the Shark
Date: Tue, 15 Apr 2008 18:30
45 lines
3040 bytes
Mike Dee wrote:

> Blinky the Shark <no.spam@box.invalid> wrote:
> 
>> Mike Dee wrote:
>>   
>>> From the Xnews manual, under the section on Regular Expression:
>>> 
>>> 3) Quantifiers (match how many times)
>>> 
>>>    *     Match 0 or more times
>>>    +     Match 1 or more times
>>>    ?     Match 1 or 0 time (i.e., optionally match) {n}   Match exactly
>>>    n times
>>>    {n,}  Match at least n times
>>>    {n,m} Match at least n but not more than m times
>> 
>> I *think* that's PCRE; I dunno if that's coincidental (if I'm right)
>> because I dunno if Xnews is totally compatible.
> 
> From the Xnews manual:
> ----------------
> Xnews uses Philip Hazel's PCRE (Perl Compatible Regular Expression)
> package, adapted for Delphi by yours truly. ----------------
> 
> So I would assume that Xnews's PCRE is compatible with Phillip Hazel's
> version of it (much of it being compatible with other PCRE out there, but
> there may be some variences and incompatibilities with say, SLRN and
> others).

Sounds like it.  Well, actually Luu Tran's Version Of Phillip Hazel's
Version.  Which *could* be pretty far from the original; although I doubt
that it is.

I wonder if versions of versions follow an inverse square law; i.e., a
version of a version of a version of a non-original version would be only
1/9 compatible with the original, rather than 1/3 as compatible.  :)
 

-- 
Blinky
Killing all posts from Google Groups
The Usenet Improvement Project: http://improve-usenet.org
Blinky: http://blinkynet.net
Re: Regex to detect long subject lines
#219443
Author: Ed
Date: Thu, 17 Apr 2008 04:42
53 lines
2867 bytes
Mike Dee <emteedee@invalid.invalid> wrote in
news:Xns9A816D4A1C13Bemteedee@193.201.53.67: 

> Ed <apostle@REMOVETHISpeculiar.homeip.net> wrote:
> 
>> I've been trying to come up with a regex that will trap overly
>> long subject lines but honestly I'm terrible at regular expression
>> syntax 
>  
> From the Xnews manual, under the section on Regular Expression:

I was too tired to think of it when I wrote that but I should have
mentioned that I need this for Hamster's kill file, not Xnews. 

> 3) Quantifiers (match how many times)
> 
>    *     Match 0 or more times
>    +     Match 1 or more times
>    ?     Match 1 or 0 time (i.e., optionally match)
>    {n}   Match exactly n times
>    {n,}  Match at least n times
>    {n,m} Match at least n but not more than m times

These same rules are in Hamster's helpfile.

>> I'd like to be able to trap any message with a subject line more than
>> 60 characters long 
> 
> The following score, based on the above rules:
> 
> %%-----------------------------
> 
> [.]
> 
>     Score: -100
>       Subject: .{60,}
> 
> %%-----------------------------
> 
> The above will do what you want.

and the same thing according to hamster's helpfile:

[news.group]
-9999 Subject: ".{60,}"

Yet messages with subject lines longer than 60characters are not getting
hit with it. 



-- 
http://blogdoofus.com
Re: Regex to detect long subject lines
#219493
Author: ยปQยซ
Date: Fri, 18 Apr 2008 04:25
20 lines
1758 bytes
Ed <apostle@REMOVETHISpeculiar.homeip.net> wrote:

> and the same thing according to hamster's helpfile:
> 
> [news.group]
> -9999 Subject: ".{60,}"
> 
> Yet messages with subject lines longer than 60characters are not
> getting hit with it. 

Is that really a quote from Hamster's helpfile?

IIRC (AITID) Hamster's scorefile syntax requires { curly braces }
around regular expressions, if you just use quotes the expressions are
treated as globs.  Try 

-9999 Subject: {.{60}}

The comma shouldn't be needed, since a Subject with >= 60 characters
contains a substring with exactly 60.
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