[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox-cvs
Subject:    [Bug 13051] New: sed: the substitute command ignores the g flag if the supplied pattern starts with 
From:       bugzilla () busybox ! net
Date:       2020-07-01 4:03:23
Message-ID: bug-13051-161 () https ! bugs ! busybox ! net/
[Download RAW message or body]

https://bugs.busybox.net/show_bug.cgi?id=13051

            Bug ID: 13051
           Summary: sed: the substitute command ignores the g flag if the
                    supplied pattern starts with '^'
           Product: Busybox
           Version: 1.31.x
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
          Assignee: unassigned@busybox.net
          Reporter: i@yvt.jp
                CC: busybox-cvs@busybox.net
  Target Milestone: ---

$ sed --help
BusyBox v1.31.1 () multi-call binary.
[...]

The commit
<https://git.busybox.net/busybox/commit/?id=f36635cec6da728fe06b849089ce2f6c1690dc67>
introduced this behavior to address the bug with `echo "aah" | sed 's/^a/b/g'`.
However, this breaks other regexs, such as:

$ echo 'a b c' | sed -E 's/^a|b|c/d/g'
d b c

Simply reordering the clauses so that '^' doesn't appear at the start makes it
working as intended:

$ echo 'a b c' | sed -E 's/b|^a|c/d/g'
d d d

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
busybox-cvs mailing list
busybox-cvs@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic