manpage searches "^\s+keyword\s" vs. ???
Eric Blake
eblake@redhat.com
Wed Jan 30 19:35:00 GMT 2019
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20190130/385a17f3/attachment.sig>
More information about the Cygwin
mailing list