delorie.com/archives/browse.cgi | search |
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=d/+j | |
lmWaiuXa6iCdlbr6oKTFOy7vLeFTD38Gje+HaEojU/8U+NodCb4JCs75iy7MelOh | |
vGN29LxX2RdaZ/q9wV9ftLHM5VdSOagr+o7Z2sbOPykKTSpG8duQOxDC9CHWHiOa | |
HmioyHZG81d11dsP7pkVEGJhhV8kBSk962B4VU8= | |
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=5ym4qo9RMl | |
9IvHq64NvYy7aIZZs=; b=B5gKW38TUGIXy+Lf2qV1iy3KGveV7eDIrbPBzX02Ca | |
lSwxDTrAC4kdEqWckkNufikPB6JCtlxWHltCuHsmM8NRoNNo3bTQ9CobxfbH5m4R | |
eg/Su0lbBOwT7TQ8fy7pvCDTtVDtkH1qDdsny9yZv0zy2Wz5Uv32H4CZGbx6AOh4 | |
c= | |
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=AWL,BAYES_00,KAM_NUMSUBJECT,SPF_HELO_PASS autolearn=no version=3.3.1 spammy=bre |
X-HELO: | mx1.redhat.com |
Subject: | Re: bug with grep 3.0.2 in cygwin 3.0.7 |
To: | cygwin AT cygwin DOT com, akiki AT free DOT fr |
References: | <1207614124 DOT 1217647925 DOT 1566976580120 DOT JavaMail DOT root AT zimbra76-e14 DOT priv DOT proxad DOT net> |
From: | Eric Blake <eblake AT redhat DOT com> |
Openpgp: | preference=signencrypt |
Message-ID: | <a78fa9ac-a336-493a-c9f7-67fc8efe42b5@redhat.com> |
Date: | Wed, 28 Aug 2019 08:22:18 -0500 |
User-Agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
MIME-Version: | 1.0 |
In-Reply-To: | <1207614124.1217647925.1566976580120.JavaMail.root@zimbra76-e14.priv.proxad.net> |
X-IsSubscribed: | yes |
--X73jsZm906is6BbcmSl8sqULB74J0QhPL Content-Type: multipart/mixed; boundary="oIaZNzH2iScvKMkpIsMBUxw8gom7cLWHO"; protected-headers="v1" From: Eric Blake <eblake AT redhat DOT com> To: cygwin AT cygwin DOT com, akiki AT free DOT fr Message-ID: <a78fa9ac-a336-493a-c9f7-67fc8efe42b5 AT redhat DOT com> Subject: Re: bug with grep 3.0.2 in cygwin 3.0.7 References: <1207614124 DOT 1217647925 DOT 1566976580120 DOT JavaMail DOT root AT zimbra76-e14 DOT priv DOT proxad DOT net> In-Reply-To: <1207614124 DOT 1217647925 DOT 1566976580120 DOT JavaMail DOT root AT zimbra76-e14 DOT priv DOT proxad DOT net> --oIaZNzH2iScvKMkpIsMBUxw8gom7cLWHO Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 8/28/19 2:16 AM, akiki AT free DOT fr wrote: > Hi,=20 > I encounter some problem with grep option -E on cygwin 3.0.7=20 >=20 >=20 > echo "a^b" | grep "a^b" #answer a^b ie it's OK=20 POSIX says: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html "A BRE special character has special properties in certain contexts. Outside those contexts, or when preceded by a <backslash>, such a character is a BRE that matches the special character itself." ... "A <circumflex> ( '^' ) shall be an anchor when used as the first character of an entire BRE. The implementation may treat the <circumflex> as an anchor when used as the first character of a subexpression." Since ^ is only special as the first character or in a [], and you have used it for neither, this is a well-specified literal match. > but=20 > echo "a^b" | grep -E "a^b" #answer nothing " for me it's KO=20 "An ERE special character has special properties in certain contexts. Outside those contexts, or when preceded by a <backslash>, such a character shall be an ERE that matches the special character itself." "A <circumflex> ( '^' ) outside a bracket expression shall anchor the expression or subexpression it begins to the beginning of a string; such an expression or subexpression can match only a sequence starting at the first character of a string. For example, the EREs "^ab" and "(^ab)" match "ab" in the string "abcdef", but fail to match in the string "cdefab", and the ERE "a^b" is valid, but can never match because the 'a' prevents the expression "^b" from matching starting at the first character." So in ERE, ^ is an anchor anywhere, while in BRE, ^ is an anchor only as the first byte. The difference you are observing matches POSIX. >=20 >=20 > I have to backslash ^ to be OK like : grep -E 'a\^b'=20 Correct. >=20 >=20 > Is-it a bug ?=20 No. (In fact, if you test on Linux, you'll see the same behavior, which shows it is not specific to Cygwin). --=20 Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org --oIaZNzH2iScvKMkpIsMBUxw8gom7cLWHO-- --X73jsZm906is6BbcmSl8sqULB74J0QhPL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEccLMIrHEYCkn0vOqp6FrSiUnQ2oFAl1mgAoACgkQp6FrSiUn Q2raWwgAklzudQ0Eyl0Lax7CG2ewRA7+e5IUdlYl9Slim+irPT7zqr2InDnWnD4F zsUZaYcuPG8gKR6zQhxfUpOHiLwN36XL4YFvegGoC6W5EFwvbKG0W4lskFww3xgK aCfPPYEF4CxXTDwu+VtYs0fAFkzWzSdIfqiMn2l2qNboUGsgGCU+41M0K3Jx134T rhZr3s5MbSHwRLdtsGbf3uRtDr/fVmjQk4QBMApwB1mel1lsUEVps8682tJPiHlW tlWknor94jPnpEIYc7sI1EtH9JDWiwEWOi+V/zhm8Ti64r7ZPm5TQo149m8D41qH 1WqMNR+PUp8XzyNdRnMlbg4Aj0ASxg== =vveG -----END PGP SIGNATURE----- --X73jsZm906is6BbcmSl8sqULB74J0QhPL--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |