🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #164179

Re: [slrn] Need help with score regexp

#164179
From: DC
Date: Sat, 19 Mar 2005 22:49
84 lines
4893 bytes
W. Citoan wrote:
> DC wrote:
>>  I am trying to devise a regular expression that will match x or more
>>  consecutive occurrences of any character, except digits.

> Is there any reason to exclude digits?  I guess in binary groups it
> would be an issue, but in other groups it doesn't seem that it would
> save many valid posts.  That exclusion makes it more complicated...

> The following should match 4 or more of any character...

>   Subject: \(.\)$1$1$1

> I tested it with only 2 occurrences and it caught the double "e" in this
> thread's subject line.

> But if you want to exclude digits here are some ideas:

>>  - 4 or more of *any* letter

>   Subject: \([a-z]\)$1$1$1

> This I also tested on using two characters (i.e. I only used one $1 in
> testing).  I wasn't able to find posts that contained 4 repeats.

>>  - 4 or more special chars like ~!@#$%^&*()-_=+[]{}|\/;:'"`<>,.?

> If you want repeating characters than:

>   Subject: \([-~!@#$%^&*()-_=+\[\]{}|\\/;:'"`<>,.?]\)$1$1$1

> If you want to match any multiple occurrence of these characters and not
> just a repeating pattern (i.e. "$%^#" in addition to "####"), then the
> following:

>   Subject: [-~!@#$%^&*()-_=+\[\]{}|\\/;:'"`<>,.?][-~!@#$%^&*()-_=+\[\]{}|\\/;:'"`<>,.?][-~!@#$%^&*()-_=+\[\]{}|\\/;:'"`<>,.?][-~!@#$%^&*()-_=+\[\]{}|\\/;:'"`<>,.?]

> Now, I doubt these two will work directly as printed.  Without a test
> post, I was unable to check the proper escaping.  Since some of those
> characters have special meanings, they usually need to be escaped, but
> not always when its inside [].  I based it off my memory of standard
> regex (but I probably made some mistakes) and I'm not sure slang is
> fully the same anyway.

> You might want to build this one up as you go.  Start with a simple one
> (like [-@#:;,.]) and add additional characters as you encounter them.
> If simply adding the character doesn't work then escape it with a "\"
> (like [-@#:;,.\[\]] where the brackets inside are escaped to prevent
> them ending the outer brackets).  The "-" must be the first character
> inside the brackets or it will be interpreted as a range and not a "-".

> Normal regex has a "not" operator for ranges that makes defining this
> case much, much easier, but I couldn't find a reference to it in slang.

>>  I wish to allow digits, however, but not in this particular instance:

>>  Subject: HELP!!!!!!1!111!1!!!!!!!111!!!111111!!!!!

> The following will match 1 or more numbers, followed by one or more !,
> followed by one or more numbers.

>   Subject: [0-9]+!+[0-9]

> If you want to match any punctuation character, substitute the ! with
> the [] expression from the previous rules.

>>  PS:  A link to an excellent online reference/tutorial for writing s-lang
>>  regexps would be very welcome, also.

> I haven't found an excellent one.  paf the dog already posted the only
> slang regex documentation I've seen.  There are some excellent tutorials
> for "standard" regex.  You could try reading those and only focus on the
> parts that slang actually implements.  A google search on regex should
> pull up plenty.

> If you want to point us to specific threads that you're having trouble
> with, I'm willing to try helping...

Thanks for all of that.  Much testing to do.  }:O)

-- 
DC              Linux RU #1000111011000111001

Customize Xnews - http://dcicons.fateback.com
Technical Details
Message-ID: <slrnd3pb3d.tfn.dcmoose@moosemeat.ca.INVALID>
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!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!elnk-atl-nf1!newsfeed.earthlink.net!newshosting.com!nx02.iad01.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!news-FFM2.ecrc.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <slrnctrh9i.hsh.dcmoose@moosemeat.ca.INVALID> <slrncu063p.3bg.wcitoan@wcitoan-via.supernews.com>

Show Full Headers
Complete Article Headers
Message-ID: <slrnd3pb3d.tfn.dcmoose@moosemeat.ca.INVALID>
Subject: Re: [slrn] Need help with score regexp
Date: Sat, 19 Mar 2005 22:49:17 +0000
From: DC <dcmoose@myrealbox.com>
References: <slrnctrh9i.hsh.dcmoose@moosemeat.ca.INVALID> <slrncu063p.3bg.wcitoan@wcitoan-via.supernews.com>
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!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!elnk-atl-nf1!newsfeed.earthlink.net!newshosting.com!nx02.iad01.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!news-FFM2.ecrc.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
Newsgroups: news.software.readers
Organization: http://dcicons.fateback.com
Lines: 84
X-Trace: individual.net 08sKnqdOIB76STpeFV/eNgRwhcSRNsv0TP7CXgykVroD6KV3yP
X-Operating-System: Mandrake Linux 10.0 (Kernel 2.6.3-7mdk)
X-Message-Flag: This message violates the USA PATRIOT Act (HR 3162),
 section 811(c). Intercepted by CARNIVORE/3.0
X-WebTV-Stationery: Standard; BGColor=black; TextColor=black
X-Face: 6k$Xf_V^i#2X;
 X~[=Ra6mGRtOw!^s%HmaNj1y5a>YCL"vEl.Jjbkww,E~kI&f[*w{j:$V6a2:LKbWg@+qt)3x"fqU\H_Fy5tk8h[Iq/XW~okpDvCa\E~!fb]{H4j@CxE<vL?4q9cxiK5;
 ZdpI@,Bk)(\e67mAw; L}WCZ/NYSX|R6Jj{omL6KT/$
User-Agent: slrn/0.9.8.1 (Linux)