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: manpage searches "^\s+keyword\s" vs. ???


On 1/30/19 1:09 PM, Eric Blake wrote:

> \s is a non-standard regex extension - glibc provides it, Cygwin has not
> (at least, historically).  POSIX provides [[:space:]] as a portable
> alternative (although not all libc have implemented all of POSIX yet),
> but is annoyingly long to type.
> 
> Similarly, BSD regex (which is where Cygwin derives its regex from)
> supports the non-standard regex extension [[:<:]] as a word boundary,
> while glibc has the same feature but spelled \<.  I also seem to recall
> a patch in the past to teach Cygwin to respect \< by expanding it to
> [[:<:]] before calling into the BSD-derived code (although I couldn't
> actually find one in a quick search); a similar patch to expand \s into
> [[:space:]] would be a reasonable idea.

Found it:
https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/regex/regcomp.c;h=180f599c#l425

and indeed, Cygwin fakes \< and \> but NOT \s or \b (for those, you'd
have to submit a patch to that spot in regcomp.c).

> 
>> I guess this is down to compilation options at this point.
> 
> Not so much compilation options of man and less, but rather the code
> used in Cygwin itself for handling regex.

Also a good read:

https://stackoverflow.com/questions/9792702/does-bash-support-word-boundary-regular-expressions

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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