🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #235455

Re: ARG!!!! \b again...

#235455
From: JimH
Date: Sun, 13 Sep 2009 11:48
69 lines
3144 bytes
Mike Dee <mikedee@emteedee.invalid> wrote in news:Xns9C85D3BE515ADemteedee@
87.106.137.111:

> JimH wrote:
> 
>> Ok, now that the previous is working I discover that only half the
>> problem is solved. I would also like to match the word "and" along
>> with the "&" character in the lines below:
>> 
>>1) this_&_that
>> 2) me_and_you
>> 3) here,_there_&_everywhere
>> 4) hands_and_feet
>> 
>> If the use of underscore as a space character was uncommon, I
>> wouldn't concern myself with the fact that the regexp \band\b|&
>> misses lines 2 and 4 since "_" doesn't trigger a word boundary.
>> Unfortunately some of the more desirable posts have come from
>> those who do this. 
>> 
>> The way I see it, the space and underscore are the only two
>> characters that are used as whitespaces that need to be matched
>> (although I'm not opposed to matching other whitespaces). Is there
>> a solution any more "elegant" than: 
>> 
>> [ _](and|&)[ _]
>> 
>> (Luckily, I don't recall ever seeing a desired Subject line
>> beginning or ending with "and" or "&")
> 
> Phase 2? ;-)
> 
> Along with word boundaries "\b" there are non-word boundaries "\B"
> 
> \B_(and|&)_\B
> 
> Will match:
> _and_
> and
> _&_
> &
> 

Yeah, after posting my second question I realized it might appear as if I 
was asking for help with my homework. It's for my own use. (Lines 3 & 7 
below hint at the NG's I intend to target)

It's more along the lines that I didn't fully define what I needed before 
trying to solve it. If I had created all 8 lines and then used them when 
testing a regexp, there would have been only the single post.


1) this_&_that
2) me_and_you
3) here,_there_&_everywhere
4) hands_and_feet
5) this & that
6) me and you
7) here, there & everywhere
8) hands and feet

When reading the above lines, the mind can easily distinguish that the 
underscore is being used as a space. If I could remove the underscore from 
the definition of a word character, the original regexp would have worked 
beautifully.

I don't understand why your regexp will match "and". It seems to me that it 
requires that two underscores appear.
Technical Details
Message-ID: <Xns9C854F4C319FAhahadotdotdot@74.209.136.98>
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!feeder.news-service.com!de-l.enfer-du-nord.net!news.glorb.com!news2.glorb.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!spln!extra.newsguy.com!newsp.newsguy.com!news6
References: <Xns9C852D00C2A53hahadotdotdot@74.209.136.97> <Xns9C85D3BE515ADemteedee@87.106.137.111>

Show Full Headers
Complete Article Headers
Message-ID: <Xns9C854F4C319FAhahadotdotdot@74.209.136.98>
Subject: Re: ARG!!!! \b again...
Date: Sun, 13 Sep 2009 11:48:05 +0000
From: JimH <nvm@nunya.biz>
References: <Xns9C852D00C2A53hahadotdotdot@74.209.136.97> <Xns9C85D3BE515ADemteedee@87.106.137.111>
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!feeder.news-service.com!de-l.enfer-du-nord.net!news.glorb.com!news2.glorb.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!spln!extra.newsguy.com!newsp.newsguy.com!news6
Newsgroups: news.software.readers
Organization: NewsGuy - Unlimited Usenet $19.95
Lines: 69
NNTP-Posting-Host: pfc38293bf9795678823b44c86ac391b201528e6de6e85ea1.newsdawg.com
User-Agent: Xnews/5.04.25