GNU bug report logs - #72850
Can't match ] in [ ] regexp bug?

Previous Next

Package: grep;

Reported by: Khoa Ton <khoa <at> puresynergy.com>

Date: Wed, 28 Aug 2024 07:01:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Khoa Ton <khoa <at> puresynergy.com>
To: 72850 <at> debbugs.gnu.org
Subject: bug#72850: Can't match ] in [ ] regexp bug?
Date: Tue, 27 Aug 2024 23:02:04 -0700
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




This bug report was last modified 295 days ago.

Previous Next


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