GNU logs - #72850, boring messages


Message sent to bug-grep@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#72850: Can't match ] in [ ] regexp bug?
Resent-From: Khoa Ton <khoa@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-grep@HIDDEN
Resent-Date: Wed, 28 Aug 2024 07:01:02 +0000
Resent-Message-ID: <handler.72850.B.17248284515012 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 72850
X-GNU-PR-Package: grep
X-GNU-PR-Keywords: 
To: 72850 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-grep@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.17248284515012
          (code B ref -1); Wed, 28 Aug 2024 07:01:02 +0000
Received: (at submit) by debbugs.gnu.org; 28 Aug 2024 07:00:51 +0000
Received: from localhost ([127.0.0.1]:48089 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sjCfg-0001Ih-PQ
	for submit <at> debbugs.gnu.org; Wed, 28 Aug 2024 03:00:51 -0400
Received: from lists.gnu.org ([209.51.188.17]:58150)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <khoaton@HIDDEN>) id 1sjBln-00085e-1z
 for submit <at> debbugs.gnu.org; Wed, 28 Aug 2024 02:03:03 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <khoaton@HIDDEN>) id 1sjBkv-0004NA-6Y
 for bug-grep@HIDDEN; Wed, 28 Aug 2024 02:02:09 -0400
Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <khoaton@HIDDEN>) id 1sjBkt-00031C-KM
 for bug-grep@HIDDEN; Wed, 28 Aug 2024 02:02:08 -0400
Received: by mail-pl1-x631.google.com with SMTP id
 d9443c01a7336-202146e9538so57025565ad.3
 for <bug-grep@HIDDEN>; Tue, 27 Aug 2024 23:02:07 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1724824925; x=1725429725;
 h=content-transfer-encoding:subject:from:content-language:to
 :user-agent:mime-version:date:message-id:dkim-signature
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=Egs/pLgqT4GzKg9H0UZlRfOYICPwEO7XdIpuROoFk4k=;
 b=iSLSGSJsJlfauPLvIoI+JRR6F82J99WtcFr4Q3yBjjyS6tdazw1Eur68IXmskzLdLP
 Si7m0Sm8StJudO4bWQApWXqUamaaV7rwSyR+XVffIGWACKaPbbkNptPCsl0ePbMGShVA
 R8+5TVbpM8oCC6iMPk25SvaY3aZ4pyGVBgeFJPSzPShX1G93aizMlYbNaTug9Snd6El/
 wM3ej0sTs0qWCfKR1YRClz5R91Wlwo3QfPxduQsNd8zwZ3F9NgQoM/lLwNkoVEeTA8/e
 TXlbbg8Gf2PCamaINZVtZ0Sxz7RzK47ojo3sNNVequoMiKnp5kzjCdzO/Ldh/Tt7xR20
 CVag==
X-Gm-Message-State: AOJu0Yz0F8NA1M9a3et3tX6+V8qr7YnkXdvCSgthVlR2pU98O4SuZ/QW
 89AjFdX9yNU16Nj1a9j45VHb4rokUARGdi9bMNoUkld+Sv2VaEsn7NYYOw==
X-Google-Smtp-Source: AGHT+IE6VGp0rjKx20xeqGJ1e57ZGNLhPVKGrgqzirSzeE+z5GpGt6NsnsLdkA18nTCRwwHf0ElbkA==
X-Received: by 2002:a17:902:ec84:b0:1fc:2ee3:d460 with SMTP id
 d9443c01a7336-2039e4aa91dmr175208215ad.35.1724824925348; 
 Tue, 27 Aug 2024 23:02:05 -0700 (PDT)
Received: from nile.puresynergy.com
 (99-149-254-146.lightspeed.sntcca.sbcglobal.net. [99.149.254.146])
 by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-20393f37480sm80788195ad.187.2024.08.27.23.02.04
 for <bug-grep@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 27 Aug 2024 23:02:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=puresynergy.com;
 s=default; t=1724824924;
 bh=Egs/pLgqT4GzKg9H0UZlRfOYICPwEO7XdIpuROoFk4k=;
 h=Date:To:From:Subject:From;
 b=Qxfea5bQw1dDy6iPxWSg3Joq7cK30wjmXoTNWAmXO4llF8RvznjDiDEf+z3nbjRR+
 /H51bj8tTlUbbkgX05Yzl3Lk560qS9kc2vTm0KrUwBYEfmKD9zdFBbScw3ANyRl7wA
 yv625cTzQkcHHTYbHUycDoip3p5RibbFnywFvf4mSStHpOBCdvb0Kb9D19rl+GHjpU
 R0P6pOEuXftb1GFqRZ61fWOr877EMx3du+Fh2b4Q8fQFp2mEgPs+5k2wc0W9FbFcYf
 UQG+lS0Q+vsbiRJpT4vVuB/JFPot+jiqcOEPMKqdusjqYhrWeydN3y+a8PBjZGGLm+
 jiKxRX9HS+nTA==
Received: from [10.0.0.39] (lena.puresynergy.com [10.0.0.39])
 by nile.puresynergy.com (Postfix) with ESMTPSA id 4EAD21A0041F;
 Tue, 27 Aug 2024 23:02:04 -0700 (PDT)
Message-ID: <ad897752-b71b-4e2e-877c-e3dd3835c74d@HIDDEN>
Date: Tue, 27 Aug 2024 23:02:04 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: en-US
From: Khoa Ton <khoa@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Received-SPF: pass client-ip=2607:f8b0:4864:20::631;
 envelope-from=khoaton@HIDDEN; helo=mail-pl1-x631.google.com
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
 FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Mailman-Approved-At: Wed, 28 Aug 2024 03:00:48 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

I'm on Ubuntu:

$ uname -a
Linux nile 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

I can't seem to get grep to match lines with ] in them when using [ ] expression.
grep only matches two characters string "\]" instead:

$ echo ']' | grep -E "[\]]" # supposed to return ] but doesn't
$ echo '\]' | grep -E "[\]]" # incorrectly matches '\]' but not ']'
\]

Possible grep bug:
grep doesn't seem to correctly handle escaped "\]" inside [ ] expressions.

Thank you,
Khoa




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Khoa Ton <khoa@HIDDEN>
Subject: bug#72850: Acknowledgement (Can't match ] in [ ] regexp bug?)
Message-ID: <handler.72850.B.17248284515012.ack <at> debbugs.gnu.org>
References: <ad897752-b71b-4e2e-877c-e3dd3835c74d@HIDDEN>
X-Gnu-PR-Message: ack 72850
X-Gnu-PR-Package: grep
Reply-To: 72850 <at> debbugs.gnu.org
Date: Wed, 28 Aug 2024 07:01:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-grep@HIDDEN

If you wish to submit further information on this problem, please
send it to 72850 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
72850: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D72850
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-grep@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#72850: Can't match ] in [ ] regexp bug?
Resent-From: arnold@HIDDEN
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-grep@HIDDEN
Resent-Date: Wed, 28 Aug 2024 08:34:01 +0000
Resent-Message-ID: <handler.72850.B72850.172483400215095 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 72850
X-GNU-PR-Package: grep
X-GNU-PR-Keywords: 
To: khoa@HIDDEN, 72850 <at> debbugs.gnu.org
Received: via spool by 72850-submit <at> debbugs.gnu.org id=B72850.172483400215095
          (code B ref 72850); Wed, 28 Aug 2024 08:34:01 +0000
Received: (at 72850) by debbugs.gnu.org; 28 Aug 2024 08:33:22 +0000
Received: from localhost ([127.0.0.1]:48165 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sjE7G-0003vP-G5
	for submit <at> debbugs.gnu.org; Wed, 28 Aug 2024 04:33:22 -0400
Received: from frenzy.freefriends.org ([198.99.81.75]:34360
 helo=freefriends.org) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arnold@HIDDEN>) id 1sjE7C-0003vD-GH
 for 72850 <at> debbugs.gnu.org; Wed, 28 Aug 2024 04:33:21 -0400
X-Envelope-From: arnold@HIDDEN
Received: from freefriends.org (localhost [127.0.0.1])
 by freefriends.org (8.16.1/8.16.1) with ESMTPS id 47S8WC871045855
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);
 Wed, 28 Aug 2024 02:32:12 -0600
Received: (from arnold@localhost)
 by freefriends.org (8.16.1/8.14.7/Submit) id 47S8WCXd1045854;
 Wed, 28 Aug 2024 02:32:12 -0600
From: arnold@HIDDEN
Message-Id: <202408280832.47S8WCXd1045854@HIDDEN>
X-Authentication-Warning: frenzy.freefriends.org: arnold set sender to
 arnold@HIDDEN using -f
Date: Wed, 28 Aug 2024 02:32:12 -0600
References: <ad897752-b71b-4e2e-877c-e3dd3835c74d@HIDDEN>
In-Reply-To: <ad897752-b71b-4e2e-877c-e3dd3835c74d@HIDDEN>
User-Agent: Heirloom mailx 12.5 7/5/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Khoa Ton <khoa@HIDDEN> wrote:

> I'm on Ubuntu:
>
> $ uname -a
> Linux nile 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
>
> I can't seem to get grep to match lines with ] in them when using [ ] expression.
> grep only matches two characters string "\]" instead:
>
> $ echo ']' | grep -E "[\]]" # supposed to return ] but doesn't
> $ echo '\]' | grep -E "[\]]" # incorrectly matches '\]' but not ']'
> \]
>
> Possible grep bug:
> grep doesn't seem to correctly handle escaped "\]" inside [ ] expressions.
>
> Thank you,
> Khoa

Grep doesn't support backslash escapes inside [...] (although awk does).

The correct way to do this is to place the ] as the first character
inside the [...], like so:

$ echo ] | grep -E '[]]'
]

HTH,

Arnold




Message sent to bug-grep@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#72850: Can't match ] in [ ] regexp bug?
Resent-From: Khoa Ton <khoa@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-grep@HIDDEN
Resent-Date: Thu, 29 Aug 2024 08:57:01 +0000
Resent-Message-ID: <handler.72850.B72850.172492176430571 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 72850
X-GNU-PR-Package: grep
X-GNU-PR-Keywords: 
To: arnold@HIDDEN, 72850 <at> debbugs.gnu.org
Received: via spool by 72850-submit <at> debbugs.gnu.org id=B72850.172492176430571
          (code B ref 72850); Thu, 29 Aug 2024 08:57:01 +0000
Received: (at 72850) by debbugs.gnu.org; 29 Aug 2024 08:56:04 +0000
Received: from localhost ([127.0.0.1]:50394 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sjawk-0007wz-Ly
	for submit <at> debbugs.gnu.org; Thu, 29 Aug 2024 04:56:03 -0400
Received: from mail-pl1-f175.google.com ([209.85.214.175]:60767)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <khoaton@HIDDEN>) id 1sjZzp-000611-TT
 for 72850 <at> debbugs.gnu.org; Thu, 29 Aug 2024 03:55:10 -0400
Received: by mail-pl1-f175.google.com with SMTP id
 d9443c01a7336-201fae21398so2510035ad.1
 for <72850 <at> debbugs.gnu.org>; Thu, 29 Aug 2024 00:54:14 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1724917988; x=1725522788;
 h=content-transfer-encoding:in-reply-to:from:content-language
 :references:to:subject:user-agent:mime-version:date:message-id
 :dkim-signature:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=kK7UrL2ZbhCqIUPQkKnvvmXgcTe1KdawXgkG+PzdZJ4=;
 b=vSKTAU8CPhajr5CiN4WCQsOSxVWWOT9BYxsrf2RUZdCLMB6Qf6hfxWJZEKNTyIffo8
 7HCE3ZEm/F1qpZbgnRwy048YGVyuILwl3EVBBk8+HjAzylBEkCv/WliVsHCdVcO5pSQU
 LzCtjuLWtbgIvWJxMV9BbDjXwCLz76GdPE3Cpn9uKZHR7Mel8XMqSjGnY4Z9w1SXp5o/
 Y/WJ8EI9UfVduFyqI4j55v5/FvfosW5gA4nxDVtsnBWRpGESpYrbkcFfvnYd0uPl/GC9
 qq4bh4TzsWH6rUjr9THLSWL2FpIXrTqmz33BuAoV/NdM9PTLcSoeYUSUiDMR3sDB09Sy
 6W7A==
X-Forwarded-Encrypted: i=1;
 AJvYcCW2r1OKBQqBcJCyzzZ3iLYV2zwhJrx3qCWsZrZpfqPHs4dPiTwwIXr8eBq2q8+sg78OSsI8Sw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YwuLJW8K91n/6PYTlIhpBCUyvjEHgDpYJ4UGScz5+PXGFuTzvvt
 jkUAiZ21sKAeXTaLH8hZk6Ati3pPWwaRDIsl6qVXK1oXl0dbpCBwXSMd4Q==
X-Google-Smtp-Source: AGHT+IFT9LnIelXu+6iUPQWzT/EOGfdnSkbUVcc9wqdKhuJ3lguInL79PTWgtTorB3xK3nacOE5qsw==
X-Received: by 2002:a17:902:da90:b0:1fd:8c25:415d with SMTP id
 d9443c01a7336-2050c3d2a05mr22360225ad.36.1724917988391; 
 Thu, 29 Aug 2024 00:53:08 -0700 (PDT)
Received: from nile.puresynergy.com
 (99-149-254-146.lightspeed.sntcca.sbcglobal.net. [99.149.254.146])
 by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-2051557bbe6sm6006265ad.309.2024.08.29.00.53.07
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 29 Aug 2024 00:53:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=puresynergy.com;
 s=default; t=1724917987;
 bh=OTZ+y2uIimfLNGOYSbePcrn0E3zqnrzezTt2uMhTpAc=;
 h=Date:Subject:To:References:From:In-Reply-To:From;
 b=TUDSeSFwU3y9fraCX5PTXkPu0a6OQMn8mvvJ3w1+0NppIqUk5fvFWKBP1tW083K9g
 OF/uzjT9mtArKDUVMr0+USmRo8283wvQyEmyM/FNy9yny3d+QFUi/LNPbgt6Tx7wkf
 oEJ5udK6srb+1sJ4izfZSBFKj+JGfr6Ye2hS0t+q0c9mC8etsokje2S7p0kiqrMKVb
 qt+bRhwi7z7CvHyWnoeq7I9U4ZewhtNBf6RD+Xm+IzkfLvozS6U+LJwyw0KngrYot5
 VEIfgkQbFOF/DWDuD/Ue3A+eEpxdr4KDJWUU+B1kCGn1wg4WHWTNUtHYgiVPjY2fC5
 OZJZ5yJ5DlzrA==
Received: from [10.0.0.39] (lena.puresynergy.com [10.0.0.39])
 by nile.puresynergy.com (Postfix) with ESMTPSA id 3B6A61A0015A;
 Thu, 29 Aug 2024 00:53:07 -0700 (PDT)
Message-ID: <b9e2e28d-f421-417b-9c3f-1314de7e36ad@HIDDEN>
Date: Thu, 29 Aug 2024 00:53:10 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
References: <ad897752-b71b-4e2e-877c-e3dd3835c74d@HIDDEN>
 <202408280832.47S8WCXd1045854@HIDDEN>
Content-Language: en-US
From: Khoa Ton <khoa@HIDDEN>
In-Reply-To: <202408280832.47S8WCXd1045854@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Mailman-Approved-At: Thu, 29 Aug 2024 04:56:01 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 8/28/2024 1:32 AM, arnold@HIDDEN wrote:
> Khoa Ton <khoa@HIDDEN> wrote:
> 
>> I'm on Ubuntu:
>>
>> $ uname -a
>> Linux nile 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
>>
>> I can't seem to get grep to match lines with ] in them when using [ ] expression.
>> grep only matches two characters string "\]" instead:
>>
>> $ echo ']' | grep -E "[\]]" # supposed to return ] but doesn't
>> $ echo '\]' | grep -E "[\]]" # incorrectly matches '\]' but not ']'
>> \]
>>
>> Possible grep bug:
>> grep doesn't seem to correctly handle escaped "\]" inside [ ] expressions.
>>
>> Thank you,
>> Khoa
> 
> Grep doesn't support backslash escapes inside [...] (although awk does).
> 
> The correct way to do this is to place the ] as the first character
> inside the [...], like so:
> 
> $ echo ] | grep -E '[]]'
> ]
> 
> HTH,
> 
> Arnold
>

Thank you.

Khoa





Last modified: Sun, 12 Jan 2025 05:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.