delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_SOFTFAIL |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <4ADD1298.6050305@byu.net> |
Date: | Mon, 19 Oct 2009 19:30:00 -0600 |
From: | Eric Blake <ebb9 AT byu DOT net> |
User-Agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com, allenhalsey AT gmail DOT com |
Subject: | Re: 1.5, 1.7: Bash regex not recognizing word boundaries |
References: | <loom DOT 20091019T224729-941 AT post DOT gmane DOT org> <f60fe000910191734ibd7aae2td2041ab0ed8216f0 AT mail DOT gmail DOT com> |
In-Reply-To: | <f60fe000910191734ibd7aae2td2041ab0ed8216f0@mail.gmail.com> |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.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 |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Mark J. Reed on 10/19/2009 6:34 PM: > 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. Indeed - \b is a GNU extension available in glibc's regcomp(), but not required by POSIX nor available in newlib. Unless/until someone contributes patches to write the same extensions to the POSIX interface, then bash won't be able to make use of those extensions. One other option would be to ask the upstream bash project if the maintainer would be willing to pull in GNU regex.c on platforms where regcomp() is POSIX-compliant but lacks GNU extensions. But it's unfortunately not on the top of my priority list. - -- Don't work too hard, make some time for fun as well! Eric Blake ebb9 AT byu DOT net volunteer cygwin bash maintainer -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkrdEpgACgkQ84KuGfSFAYAIQgCguZuAheKrgoZuqrgIoNXIWVMy TUoAn3cnV1S4LYSs590NTXsP7BW9G2NP =T93e -----END PGP SIGNATURE----- -- 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |