thanks.
it turned out that all I needed was to change it from
preg_match_all("/domain.dk(.){0,1} mail is handled by ([0-9]{1,3}) ([\n$]+)(\n|$)/",$dns,$regs);
to
preg_match_all("/domain.dk(.){0,1} mail is handled (pri=([0-9]{1,3})) by ([\n$]+)(\n|$)/",$dns,$regs);
You pointed me in the right direction, so thank you for that 🙂