Web lists-archives.com

Re: manpage searches "^\s+keyword\s" vs. ???




On 1/30/19 12:40 PM, Andrey Repin wrote:

> 
> I've been puzzled by this since… forever, it seems.
> This is something in less, but all the `man less` says is "regular expression
> library provided by your system".

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

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

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

Attachment: signature.asc
Description: OpenPGP digital signature