GNU bug report logs - #62745
Color only capture group

Previous Next

Package: grep;

Reported by: Dan Jacobson <jidanni <at> jidanni.org>

Date: Mon, 10 Apr 2023 06:57:02 UTC

Severity: normal

To reply to this bug, email your comments to 62745 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#62745; Package grep. (Mon, 10 Apr 2023 06:57:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Mon, 10 Apr 2023 06:57:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dan Jacobson <jidanni <at> jidanni.org>
To: bug-grep <at> gnu.org
Subject: Color only capture group
Date: Mon, 10 Apr 2023 14:55:05 +0800
I only want the c colored when doing:
$ echo abcedc|grep --color 'b\(c\)'
I read (info "(grep) Environment Variables")
but it apparently doesn't have much to do with what I want.
Therefore I hereby propose it as a new feature.
grep (GNU grep) 3.8




Information forwarded to bug-grep <at> gnu.org:
bug#62745; Package grep. (Wed, 12 Apr 2023 06:52:01 GMT) Full text and rfc822 format available.

Message #8 received at 62745 <at> debbugs.gnu.org (full text, mbox):

From: Carlo Arenas <carenas <at> gmail.com>
To: Dan Jacobson <jidanni <at> jidanni.org>
Cc: 62745 <at> debbugs.gnu.org
Subject: Re: bug#62745: Color only capture group
Date: Tue, 11 Apr 2023 23:51:34 -0700
You can do that already with PCRE2 and a lookbehind:

  echo abcedc|ggrep --color -P '(?=b)c'




Information forwarded to bug-grep <at> gnu.org:
bug#62745; Package grep. (Wed, 12 Apr 2023 06:57:01 GMT) Full text and rfc822 format available.

Message #11 received at 62745 <at> debbugs.gnu.org (full text, mbox):

From: Carlo Arenas <carenas <at> gmail.com>
To: Dan Jacobson <jidanni <at> jidanni.org>
Cc: 62745 <at> debbugs.gnu.org
Subject: Re: bug#62745: Color only capture group
Date: Tue, 11 Apr 2023 23:56:11 -0700
On Tue, Apr 11, 2023 at 11:51 PM Carlo Arenas <carenas <at> gmail.com> wrote:
>
>   echo abcedc|ggrep --color -P '(?=b)c'

typo:

   echo abcedc|ggrep --color -P '(?<=b)c'

`ggrep`, would be called grep in your environment




Information forwarded to bug-grep <at> gnu.org:
bug#62745; Package grep. (Wed, 12 Apr 2023 07:09:02 GMT) Full text and rfc822 format available.

Message #14 received at 62745 <at> debbugs.gnu.org (full text, mbox):

From: Dan Jacobson <jidanni <at> jidanni.org>
To: Carlo Arenas <carenas <at> gmail.com>
Cc: 62745 <at> debbugs.gnu.org
Subject: Re: bug#62745: Color only capture group
Date: Wed, 12 Apr 2023 15:07:54 +0800
Indeed,
echo abcedc|grep --color -P '(?<=b)c'
works!
Let's hope this example gets mentioned on there on the Info page.





This bug report was last modified 1 year and 261 days ago.

Previous Next


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