This works for me, I think, though I'll accept that I could be missing some fundamental point:
IPv4_first=1.1.1.1
IPv4_second=2.2.2.2
IPv4_third=3.3.3.3
IPv4_all=( $(set | sed '/IPv4_.*[=)]/!d;s///') )
printf "'%s'\n" "${IPv4_all[@]}"
###OUTPUT###
'1.1.1.1'
'2.2.2.2'
'3.3.3.3'
This is better:
eval "IPv4_all=( "$( set |
tr -dc '[:alnum:]_\n=' |
sed '/=.*/!d;s///;s/^IPv4_.*/${&+"$&"} /p;d'
)" )"
tr ensures that no characters are returned that could not exist in a variable name (excepting =\n which are retained as delimiters) to safe the eval statement for reparse. And the shell ${expands+} any false positives away to nothing.