#!/usr/local/bin/zsh-5.3.1 typeset -gAH ZUI ZUI[PLUS]=$'\21' ZUI[COLOR_END]=$'\037' button1='this module ON-THE-FLY, without list restart' # not working button2='this module ONTHEFLY, without list restart' # working local -A colormap colormap=( "" "" ) translate_color_marks() { # Working # disp_list=( "${disp_list[@]//(#b)([$'\03'-$'\010'$'\022'])(${ZUI[PLUS]}([$'\011'-$'\020'])|)([^$'\03'-$'\010'${ZUI[COLOR_END]}]#)${ZUI[COLOR_END]}/${colormap[${match[1]}]}${colormap[${match[3]}]}$match[4]$RESET}" ) # Not working disp_list=( "${disp_list[@]//(#b)([$'\03'-$'\010'$'\022'])(${ZUI[PLUS]}([$'\011'-$'\020'])|)([^${ZUI[COLOR_END]}$'\03'-$'\010']#)${ZUI[COLOR_END]}/${colormap[${match[1]}]}${colormap[${match[3]}]}$match[4]$RESET}" ) } disp_list=( "$button1" "$button2" ) translate_color_marks print -rl -- "${disp_list[@]}" "---" >> ~/result.txt