delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/11/24/17:18:59

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Eric Blake <ebb9 AT byu DOT net>
Subject: Re: Cygwin bash regexp matching doesn't treat "\b" properly
Date: Tue, 24 Nov 2009 22:18:27 +0000 (UTC)
Lines: 39
Message-ID: <loom.20091124T231321-600@post.gmane.org>
References: <26500158 DOT post AT talk DOT nabble DOT com> <26500814 DOT post AT talk DOT nabble DOT com> <4B0C4C2A DOT 3080502 AT gmail DOT com> <26503748 DOT post AT talk DOT nabble DOT com>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
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

aputerguy <nabble <at> kosowsky.org> writes:

> HOWEVER, this solution while sweet for cygwin-bash, has the CONVERSE
> PROBLEM.
> Apparently, the special strings [[:<:]] and [[:>:]] are not recognized under
> Linux regex(7) - they give return code 2.

And why is that surprising?  'man 7 regex' _did_ state:

 There  are  two  special  cases-  of  bracket  expressions: the bracket
       expressions `[[:<:]]' and `[[:>:]]' match the null string at the begin-
       ning  and  end of a word respectively.  A word is defined as a sequence
       of word characters which is neither preceded nor followed by word char-
       acters.   A  word  character  is  an  alnum  character  (as  defined by
       ctype(3)) or an underscore.  This is an extension, compatible with  but
       not specified by POSIX 1003.2, and should be used with caution in soft-
       ware intended to be portable to other systems.

> 
> So, now I have the frustrating situation where \\b works in Linux but not in
> Cygwin while [[:<:]] works in Cygwin but not in Linux.

So, in true open source fashion, why not write a patch that teaches cygwin's 
regex(3) implementation that \b is a synonym to [[:<:][:>:]]?

I, for one, would readily accept such a patch.  But it hasn't yet crept high 
enough on my personal itch list for me to spend the time writing it.

Or, from a capitalistic viewpoint, is there anyone out there willing to pay for 
my time to write the patch on their behalf?  However, please be careful in how 
you respond to this offer (that is, this is one time where private email makes 
more sense to settle on a fair price, rather than advertising the entire 
transaction on the publicly archived cygwin list, if only so that what I 
consider a fair price does not set an unreasonable precedence for what someone 
else considers a fair price).

-- 
Eric Blake



--
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