local list=$1 # function takes name of array as argument. eval 'list=( "${(@M)list:#(#i)*$SEARCHBUF*}" )' # filter the array.