Subject: Re: bug#78940: REGEX wrongfully matches pattern
From: Jim Meyering <[email-masked]>
To: Davide Brini <[email-masked]>
Cc: [email-masked]
Date: Thu, 3 Jul 2025 10:03:54 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

tags 78940 notabug
close 78940
stop

On Wed, Jul 2, 2025 at 6:27 AM Davide Brini via <[email-masked]> wrote:
> On Tue, 1 Jul 2025 20:26:16 +0000, "Duchesne, Alexandre"
> <[email-masked]> wrote:
>
> > Hi,
> >
> > I wanted to show to my classmate the comportment of a RegEX using sed to
> > capture the subgroup in a pattern match.
> >
> > But, when trying with sed -E, the pattern matched even though it should
> > not have.
> >
> > Can someone explain to me why if this comportment turns out to be normal ?
> >
> > View snippet :
> >
> > $ echo abc | grep -E '(...).+' -c
> > 0
> > $ echo abc | sed -E 's/(...).+/\1/'
> > abc
>
> This is all expected behavior. Your regexp does not match, no sostitution
> is performed, and sed prints the input line unchanged, which is the default
> behavior (disable with sed -n).

Thanks for replying. I've marked this issue as resolved and "not a bug".