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 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: 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 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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: List-Subscribe: List-Archive: List-Post: List-Help: , 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 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