Article View: news.software.readers
Article #242884Re: [Xnews] Looking for regex help - 20 CAPITAL letters in subject header?
From: Mike Yetto
Date: Fri, 01 Oct 2010 12:05
Date: Fri, 01 Oct 2010 12:05
92 lines
5042 bytes
5042 bytes
Gene E. Bloch <not-me@other.invalid> writes and having writ moves on.
>On Thu, 30 Sep 2010 18:31:40 -0400, Mike Yetto wrote:
>> Gene E. Bloch <not-me@other.invalid> writes and having writ moves on.
>>>On Thu, 30 Sep 2010 13:13:54 -0400, Mike Yetto wrote:
>>
>>>> Bert Hyman <bert@iphouse.com> writes and having writ moves on.
>>>>>In news:Xns9E0350120FCD5bookwight@207.246.207.159 BookWight
>>>>><Bookwight@publicspam.com> wrote:
>>>>
>>>>>> Hi -
>>>>>>
>>>>>> I need help; I'm trying to filter out the subject headers which have
>>>>>> 'x' amount of capital letters in the subject.
>>>>>>
>>>>>> All helpful suggestions welcome
>>>>
>>>>>If there are no spaces, reading TFM suggests this:
>>>>
>>>>>[A-Z]{x}
>>>>
>>>>>If there are spaces or other characters, things get more complicated.
>>>>
>>>>>See the section "Regular expression", "3) Quantifiers (match how many
>>>>>times)"
>>>>
>>>> A simpler approach would be to look for at least one lower-case
>>>> character. To do this you need to set the regex to case
>>>> sensitive with an = sign. Then look for [a-z] and negate the
>>>> expression.
>>>>
>>>> #v+
>>>> [*]
>>>> Score:: -9999
>>>> ~Subject:= [a-z]
>>>> #v-
>>>>
>>>> Or you can look for a minimum number of lower-case characters
>>>> greater than one with the {n} construct.
>>>>
>>>> Mike "answer too hard? change the question" Yetto
>>
>>>As I read it, that's not quite what he asked.
>>
>>>I would say he needs a way to count UC letters, and score it if the
>>>number is x or more. Or exactly x; he was possibly ambiguous...
>>
>>>All I can think of is start with Subject:=[A-Z][~A-Z]+
>>>and concatenate enough such selectors (*both* sets of brackets) to the
>>>above to make x of them.
>>
>>>I don't have xnews handy, so I'm guessing about the syntax. I mean
>>>[~A-Z]+ to stand for 1 or more characters that aren't UC letters.
>>
>> I assumed the OP wanted to score on shouted subject lines as this
>> is a hallmark of spam. If the requirement is a specific or
>> minimum number of upper case characters we'll need some more
>> information.
>>
>> Should the UC characters be contiguous? Can they be separated by
>> whitespace? If so, do the whitespace characters count? If they
>> can be interspersed with lower case characters or numbers this
>> could get very tricky.
>>
>> Mike "awaiting the new specs" Yetto
>Meantime, what I wrote isn't even what I should've written :-)
>I'm assuming that the OP wants to find x characters that are uppercase,
>but which might or might not be contiguous.
>Given that, the plus sign I used should be a * or dot (as said above, I
>don't recall what xnews uses), to indicate 0 or more non-uppercase
>characters.
>If xnews allows it, maybe there's a way to indicate x instances of my
>regex, like (regex)12, when x is 12, instead of writing it 12 times.
>If my assumption is not what the drive-by OP wanted, all bets are off.
How about starting with this...
Subject:= ([A-Z][~A-Z]*){n}
The intent is to look for a UC character optionally followed by
other characters n times. The 'n' can be changed from an exact
number to a minimum with a comma.
Mike "testing is left as an exercise for the reader" Yetto
--
In theory, theory and practice are the same.
In practice they are not.
Technical Details
Message-ID:
<slrn20101001075806.483.twooffive@may.eternal-september.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!xlned.com!feeder3.xlned.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mailReferences:
<Xns9E0350120FCD5bookwight@207.246.207.159> <Xns9E03730466944VeebleFetzer@216.250.188.141> <slrn20100930130743.632.twooffive@may.eternal-september.org> <hzp2g19rrxa3$.1qs9z2e0o64o9.dlg@40tude.net> <slrn20100930182657.380.twooffive@may.eternal-september.org> <eby8yvz4ebfg$.12vrytnc6gfn6$.dlg@40tude.net>Show Full Headers
Complete Article Headers
Message-ID: <slrn20101001075806.483.twooffive@may.eternal-september.org> Subject: Re: [Xnews] Looking for regex help - 20 CAPITAL letters in subject header? Date: Fri, 01 Oct 2010 08:05:06 -0400 From: Mike Yetto <myetto1@nycap.invalid> References: <Xns9E0350120FCD5bookwight@207.246.207.159> <Xns9E03730466944VeebleFetzer@216.250.188.141> <slrn20100930130743.632.twooffive@may.eternal-september.org> <hzp2g19rrxa3$.1qs9z2e0o64o9.dlg@40tude.net> <slrn20100930182657.380.twooffive@may.eternal-september.org> <eby8yvz4ebfg$.12vrytnc6gfn6$.dlg@40tude.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!xlned.com!feeder3.xlned.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail Newsgroups: news.software.readers Organization: slrn Mafia / Xnews Tong (emeritus) Lines: 92 Injection-Date: Fri, 1 Oct 2010 12:12:04 +0000 (UTC) Injection-Info: may.eternal-september.org; posting-host="LagJXPyKy0Sy/aUTUT+6gw"; logging-data="32306"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18F7PMjUZ/2GhnK4jI+m3KfKJkzLE37AQg=" User-Agent: slrn/pre1.0.0-24/co (Kubuntu 10.04; 64bit) X-The-Usenet-Improvement-Project: http://twovoyagers.com/improve-usenet.org/ X-No-Bananas: Yes Cancel-Lock: sha1:UMNFSvsL41T4lHEIR16mImYOMlg= sha1:XlK4tII0uXeUvtXljS910tD0qq0=