Article View: news.software.readers
Article #235449Re: [xnews] Another \b question
From: »Q«
Date: Sun, 13 Sep 2009 03:19
Date: Sun, 13 Sep 2009 03:19
36 lines
1977 bytes
1977 bytes
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|&
Technical Details
Message-ID:
<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!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder.erje.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mailReferences:
<Xns9C84D62037159hahadotdotdot@74.209.136.99>Show Full Headers
Complete Article Headers
Message-ID: <20090912221952.67063bfc@bellgrove.remarqs.net> Subject: Re: [xnews] Another \b question Date: Sat, 12 Sep 2009 22:19:52 -0500 From: »Q« <boxcars@gmx.net> References: <Xns9C84D62037159hahadotdotdot@74.209.136.99> 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.erje.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Newsgroups: news.software.readers Organization: none Lines: 36 Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: individual.net hzGcCberO/w6UTZBu9FnRw44x9WGeuKx7VIC+h93pany+ut1uX X-Orig-Path: bellgrove.remarqs.net!not-for-mail Cancel-Lock: sha1:X3jBZUCWXIa2xQeMf45mJ5e3AEY= X-Newsreader: Claws Mail 3.7.2 (GTK+ 2.14.7; i686-pc-linux-gnu)