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 |
grep -E '^IPv4_[_[:alnum:]]*=\]]*=([^(]\|$\]|$)' |
sed 's/\([^=]*\).*/${\1+"$\1"} /')"
)
grep only gets safe lines that match your target var. sed surrounds them in parameter expansion tokens so they evaluate away to nothing if they're not actually current shell variable names.