The following is taken from a brilliant answer on unix.se. Posting it here for personal reference. The question was:
${var//pattern/replacement}
is using zsh wildcard patterns for pattern
, the same ones as used for filename generation aka globbing which are a superset of the sh
wildcard patterns. The syntax is also affected by the kshglob
and extendedglob
options. The ${var//pattern/replacement}
comes from the Korn shell initially.
I'd recommend enabling extendedglob
(set -o extendedglob
in your ~/.zshrc
) which gives you the most features (more so than standard EREs) at the expense of some backward incompatibility in some corner cases.
You'll find it documented at info zsh 'filename generation'
.