Skip to content

[bug] ${var//*(pat)/rep} skips empty-string matches #1091

Closed

Description

@caomengxuan666

[bug] ${var//*(pat)/rep} skips empty-string matches (GNU replaces them)

shopt -s extglob; w='abac'; echo "${w//*(a)/Q}"
# GNU bash 5.3:  QQbQQc
# niu:           QbQc
v='x'; echo "[${v//*(y)/Q}]"
# GNU: [Qx] | niu: [x]

+(...), @(...), plain */? globals all match — only *()/?() empty-match replacement diverges.

Env: niubash 1.4.4 / rubash engine (master ~2026-10), GNU bash 5.3.20 aarch64-linux-android as oracle.

Activity

  1. added
    bug
    gnu-baseline
    area:expansion
    P2-medium
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2-mediumarea:expansionbuggnu-baseline

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions