Thread:Project:Support desk/Block all external links except those in a specific whitelist (2)

I've been trying to read up about many different extensions but finding the answer to this specific question has eluded me.

For instance, I want to lock down my wiki to ALL external links except those for sites that I have whitelisted.

Can someone give me a bit of a hand hold on how to do this?

I know I can stop ALL external links via

$wgSpamRegex = "/http:\/\//";
 * 1) Block ALL external links

But I'm not sure how to create a whitelist. Thanks in advance! :)