The script may purge some of these packages
$ dpkg-query -W -f='${Package}\n' 'linux-headers-*' | grep -E ^linux-headers-[[:digit:].]+-[^-]+-.*$
but not these packages
$ dpkg-query -W -f='${Package}\n' 'linux-headers-*' | grep -E ^linux-headers-[[:digit:].]+-[^-]+$
The script may purge some of these packages headers- [[:digit: ].]+-[^ -]+-.*$ headers- [[:digit: ].]+-[^ -]+$
$ dpkg-query -W -f='${Package}\n' 'linux-headers-*' | grep -E ^linux-
but not these packages
$ dpkg-query -W -f='${Package}\n' 'linux-headers-*' | grep -E ^linux-