Article View: news.software.readers
Article #242885Re: [Xnews] Looking for regex help - 20 CAPITAL letters in subject header?
From: Gene E. Bloch
Date: Fri, 01 Oct 2010 21:23
Date: Fri, 01 Oct 2010 21:23
102 lines
5461 bytes
5461 bytes
On Fri, 01 Oct 2010 08:05:06 -0400, Mike Yetto wrote:
> 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
Thanks for that, Mike. I was (justifiably, I say!) lazy about RTFM,
since I'm not running xnews, but I though my idea might be a good
starting point for the OP.
If the OP is gone, so be it, but your detailed answer should help others
who *are* using xnews. And maybe the same idea will work for other
newsreaders as well, mutatis mutandis.
--
Gene E. Bloch (Stumbling Bloch)
Technical Details
Message-ID:
<l8kj04nq5y89.p0vk321749dn$.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!weretis.net!feeder4.news.weretis.net!news.albasani.net!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> <slrn20101001075806.483.twooffive@may.eternal-september.org>Show Full Headers
Complete Article Headers
Message-ID: <l8kj04nq5y89.p0vk321749dn$.dlg@40tude.net> Subject: Re: [Xnews] Looking for regex help - 20 CAPITAL letters in subject header? Date: Fri, 1 Oct 2010 14:23:08 -0700 From: "Gene E. Bloch" <not-me@other.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> <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!weretis.net!feeder4.news.weretis.net!news.albasani.net!not-for-mail Newsgroups: news.software.readers Organization: Astrolabe Lines: 102 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net hyoVdPY94MKS8PzR/ikC+6fB7p7QOaEYTsHfaSBTS5ZJ7k7XbPlY5cCqqLEQW4HkDYubvMXiHAT48o4EFi5HMA== NNTP-Posting-Date: Fri, 1 Oct 2010 21:23:10 +0000 (UTC) Cancel-Lock: sha1:hbgbTQN2KEfCG2sMHaV/oSulDd4= User-Agent: 40tude_Dialog/2.0.15.84 Injection-Info: news.albasani.net; logging-data="m1WttsjHUOLaMPQRAlHIpU64f4uQjG8e8M3D7s9sE92yoO8zhkjjqvPqAFlZFRKw72vEelDMUjQL73NKpZ1Wcd/lKYZykeoCeJUygCjVlQ/UHJ1xsPKuakCWTtmh28wk"; mail-complaints-to="abuse@albasani.net"