This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cygwin bash regexp matching doesn't treat "\b" properly


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]