Even this doesn't work: gitcmd=( git log --max-count=2 --pretty=format:'<<<<<%h>>>>><<<<<%s>>>>><<<<<%d>>>>><<<<<%cr>>>>><<<<<%an>>>>>' --abbrev-commit ) gitout=( "${gitout[@]//(#b)<<<<<(*)>>>>><<<<<(*)>>>>><<<<<(*)>>>>><<<<<(*)>>>>><<<<<(*)>>>>>/${match[1]} ${(q-)match[2]}} >${match[3]}< ${(q-)match[4]} ${match[5]}" ) Example outputs (the same repos): <<<<<15f1acd>>>>><<<<>>>><<<<< (HEAD -> master, origin/master)>>>>><<<<<4 days ago>>>>><<<<>>>> <<<<<0280384>>>>><<<<>>>><<<<<>>>>><<<<<4 days ago>>>>><<<<>>>> 15f1acd 'Updated README.md' 0280384 'Information on source of *foo*~^*bar*' >< '4 days ago' Sebastian Gniazdowski <<<<>>>><<<<>>>><<<<< (HEAD -> master)>>>>><<<<<3 hours ago>>>>><<<<>>>> <<<<>>>><<<<>>>><<<<< (origin/master)>>>>><<<<<3 hours ago>>>>><<<<>>>> e6d9a0e 'A stub for uizcm, with binding (^O^U)' feb4624 'myctags: Message about recompilation request' > (origin/master)< '3 hours ago' Sebastian Gniazdowski ===================================== #!/usr/bin/env zsh-5.2 emulate -LR zsh setopt extendedglob gitcmd=( git log --max-count=2 --pretty=format:'<<<<<%h>>>>><<<<<%s>>>>><<<<<%d>>>>><<<<<%cr>>>>><<<<<%an>>>>>' --abbrev-commit ) gitout=( "${(@f)"$( "${gitcmd[@]}" )"}" ) print -rl -- "${gitout[@]}" gitout=( "${gitout[@]//(#b)<<<<<(*)>>>>><<<<<(*)>>>>><<<<<(*)>>>>><<<<<(*)>>>>><<<<<(*)>>>>>/${match[1]} ${(q-)match[2]}} >${match[3]}< ${(q-)match[4]} ${match[5]}" ) print -rl -- "${gitout[@]}"