delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/10/19/20:34:13

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <loom.20091019T224729-941@post.gmane.org>
References: <loom DOT 20091019T224729-941 AT post DOT gmane DOT org>
Date: Mon, 19 Oct 2009 20:34:03 -0400
Message-ID: <f60fe000910191734ibd7aae2td2041ab0ed8216f0@mail.gmail.com>
Subject: Re: 1.5, 1.7: Bash regex not recognizing word boundaries
From: "Mark J. Reed" <markjreed AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Mon, Oct 19, 2009 at 4:50 PM, Allen Halsey wrote:
These should print "Matched", but they don't:

$ REGEX='\bcat\b'
$ [[ "dog cat bird" =~ $REGEX ]] && echo "Matched"
$ REGEX='\<cat\>'
$ [[ "dog cat bird" =~ $REGEX ]] && echo "Matched"

It's worth noting that this is not limited to Cygwin; I'm seeing the
same behavior on OS X (with the same version of bash as my Linux
system where the above works as intended).   I suspect it's a factor
of the regex library used to build bash rather than bash itself.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019