delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/01/30/14:36:08

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type; q=dns; s=default; b=bY+c
mLRzFv4KHe2fySxgEoxQKTsGlc26S75O9ZqWAXtLb4bZhTXSNseliUIYFijOXzIi
OfYUHAvaw8ihptumcJ/qfQw73ozJwg41+mKw4ItENZ65wWuPEaYRU9av+1U+zI4W
gH5FBwTAc5HVZlBULqtetX+xYJH+AeA9yxMe7YQ=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type; s=default; bh=1yAiWyN0Cz
r/iCsDuxrcIVKuTys=; b=wgjka8p2qLN7fX9RxOCjzYfRe5i9Yde77M1AY4qe5P
KMg05KkXg+QChjXH+J0Q83tp5+Rih3sN7cQdglnAdtgTzsUQK0Oz68leOJXJ+ZoZ
kqNIIIkBx9RFUgpgzZnin03FpkpJqFvl8Bm2ZacFpGZl9UxjlfiBvsT10MhSCiBV
Y=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Principal
X-HELO: mx1.redhat.com
Subject: Re: manpage searches "^\s+keyword\s" vs. ???
To: cygwin AT cygwin DOT com
References: <5C4E5F0F DOT 2090403 AT tlinx DOT org> <1210066491 DOT 20190130214043 AT yandex DOT ru> <c8f36794-db4a-8148-0547-eaad351c7795 AT redhat DOT com>
From: Eric Blake <eblake AT redhat DOT com>
Openpgp: preference=signencrypt
Message-ID: <5ff5040c-ae51-8b0b-4157-e4a0b8f778c8@redhat.com>
Date: Wed, 30 Jan 2019 13:35:54 -0600
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0
MIME-Version: 1.0
In-Reply-To: <c8f36794-db4a-8148-0547-eaad351c7795@redhat.com>
X-IsSubscribed: yes

--CIBnOk5MIqGuAQT8W9ApApBXcXf2msVaE
Content-Type: multipart/mixed; boundary="x1G6d553n0YxuHsrCHXZrSRoeVAXPdcXU";
 protected-headers="v1"
From: Eric Blake <eblake AT redhat DOT com>
To: cygwin AT cygwin DOT com
Message-ID: <5ff5040c-ae51-8b0b-4157-e4a0b8f778c8 AT redhat DOT com>
Subject: Re: manpage searches "^\s+keyword\s" vs. ???
References: <5C4E5F0F DOT 2090403 AT tlinx DOT org> <1210066491 DOT 20190130214043 AT yandex DOT ru>
 <c8f36794-db4a-8148-0547-eaad351c7795 AT redhat DOT com>
In-Reply-To: <c8f36794-db4a-8148-0547-eaad351c7795 AT redhat DOT com>


--x1G6d553n0YxuHsrCHXZrSRoeVAXPdcXU
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable

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.
>=20
> 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=3Dnewlib-cygwin.git;a=3Dblob;f=3Dwinsup/cygwi=
n/regex/regcomp.c;h=3D180f599c#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).

>=20
>> I guess this is down to compilation options at this point.
>=20
> 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

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


--x1G6d553n0YxuHsrCHXZrSRoeVAXPdcXU--

--CIBnOk5MIqGuAQT8W9ApApBXcXf2msVaE
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEccLMIrHEYCkn0vOqp6FrSiUnQ2oFAlxR/JoACgkQp6FrSiUn
Q2q5Bgf+KZfUnlFNfdYGVK8kLt1/+bK+qJUe5C5pclf5/LLdPDvaZ0zWy3vLi9ej
pkEH/XBu34D2roP8eo+suD7mZ1bEOT2VAYgTa5+8UOExlhO03iKzHWUnU/mifuO7
FvEjxwx/SUqOr+RxSyyc3nT21mNIdJ8aYPlQC21UNi03zbzCnqQPVjxlu/b2xxqS
knZuArq4NmrsMGPAsMwFp96TSsxtP9TsbQjzH65L+qbQvQg9QEPpupF5JdEyfTqC
ntp+Xqv+dBk5ZdVZ+U7UDuC46CD5Uk84MHJoNnLVRb0PCq5Wau6wpiW9jDCWZMIf
Ix9u55qbvWa11SJdhkkzjaWQ4TTNTQ==
=fpvA
-----END PGP SIGNATURE-----

--CIBnOk5MIqGuAQT8W9ApApBXcXf2msVaE--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019