🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #235450

Re: [xnews] Another \b question

#235450
From: JimH
Date: Sun, 13 Sep 2009 07:29
43 lines
2103 bytes
=?UTF-8?B?wrtRwqs=?= <boxcars@gmx.net> wrote in 
news:20090912221952.67063bfc@bellgrove.remarqs.net:

> In <news:Xns9C84D62037159hahadotdotdot@74.209.136.99>,
> JimH <nvm@nunya.biz> wrote:
> 
>> I'm trying to get familiar with \b, and I've hit a snag that I can't
>> find an answer for.
>> 
>> I'm trying to match with either the word "and" or the character "&".
>> 
>> I created the following four lines of text to test my regexp on:
>> 
>> 1) this & that
>> 2) me and you
>> 3) here, there & everywhere
>> 4) hands and feet
>> 
>> When I use the regexp (and|&) it will match everywhere desired, but
>> of course also gives an unwanted match on the word "hands." (I put it
>> there specifically for the false match)
>> 
>> So I changed the regexp to:
>> 
>> \b(and|&)\b
>> 
>> Now it matches only the word "and" on lines 2 and 4, but not the "&"
>> in lines 1 and 3. Why?
> 
> Because there's no word boundary between the ampersand and
> whitespaces;  neither of them are word characters.
> 
>> What change do I need to make?
> 
> \band\b|&
> 
> 
> 
> 
> 

That makes a lot of sense, thanks.
Technical Details
Message-ID: <Xns9C852379E6AAFhahadotdotdot@74.209.136.97>
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!num2.nntp.dca.giganews.com!num1.nntp.dca.giganews.com!number.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns11feed!worldnet.att.net!199.45.49.37!cyclone1.gnilink.net!gnilink.net!spln!extra.newsguy.com!newsp.newsguy.com!news6
References: <Xns9C84D62037159hahadotdotdot@74.209.136.99> <20090912221952.67063bfc@bellgrove.remarqs.net>

Show Full Headers
Complete Article Headers
Message-ID: <Xns9C852379E6AAFhahadotdotdot@74.209.136.97>
Subject: Re: [xnews] Another \b question
Date: Sun, 13 Sep 2009 07:29:35 +0000
From: JimH <nvm@nunya.biz>
References: <Xns9C84D62037159hahadotdotdot@74.209.136.99> <20090912221952.67063bfc@bellgrove.remarqs.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!num2.nntp.dca.giganews.com!num1.nntp.dca.giganews.com!number.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns11feed!worldnet.att.net!199.45.49.37!cyclone1.gnilink.net!gnilink.net!spln!extra.newsguy.com!newsp.newsguy.com!news6
Newsgroups: news.software.readers
Organization: NewsGuy - Unlimited Usenet $19.95
Lines: 43
NNTP-Posting-Host: pbfd30e549f7ec00a153f7a027154b41a7baedfc89300df0d.newsdawg.com
User-Agent: Xnews/5.04.25