Subject: Re: bug#38725: Regexp bug

From: Assaf Gordon <[email-masked]>
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 <[email-masked]>
> wrote:
> 
>> akem@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