@jimmij gave a great answer, and that works in the general case for printing the matches to the pattern for each key in an associative array.
In the case of
zsh environment variables, however, there's a built-in solution I found using the
typeset command when I was reading
You can just use
-m option, and supply in quotes the pattern of parameter names you are trying to match.
Printing Environment Variables Matching a Pattern
Just the variable name:
typeset +m 'foo*'
Variable name and assigned value:
typeset -m 'foo*'
Typeset flags, variable name, and assigned value
typeset -p -m 'foo*'
typeset -a food=( my life )