GNU bug report logs - #38725
Regexp bug

Previous Next

Package: sed;

Reported by: Chewbaka Roskov <akem3210 <at> gmail.com>

Date: Mon, 23 Dec 2019 22:33:02 UTC

Severity: normal

Tags: notabug

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Davide Brini <dave_br <at> gmx.com>, 38725 <at> debbugs.gnu.org
Subject: bug#38725: Regexp bug
Date: Tue, 24 Dec 2019 14:34:37 -0700
tag 38725 notabug
close 38725
stop

Hello,

On 2019-12-24 10:30 a.m., Davide Brini wrote:
> On Mon, 23 Dec 2019 23:09:28 +0100, Chewbaka Roskov <akem3210 <at> gmail.com>
> wrote:
> 
>> akem <at> akem-HP:~$ echo '112233' | sed 's/2*//'  ### DOESN'T WORK
>> 112233
> 
> You're asking for "zero or more twos". At the beginning of the string (and
> between each pair of characters) there is indeed a zero-length match for
> your regexp, which sed duly replaces with nothing as you asked. Had you
> replaced with something or used the /g switch to the "s" command, you'd
> have seen it. For example:
> 
> $ echo '112233' | sed 's/2*//g'
> 1133
> $ echo '112233' | sed 's/2*/XXX/'
> XXX112233

Thank you Davide for the clear explanation.

I'm closing this as "not a bug", but discussion can continue
by replying to this thread.

regards,
 -assaf






This bug report was last modified 5 years and 210 days ago.

Previous Next


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