extracting lines from a multiline content with a reference table

Hello. I need to extract specific patent numbers from a list of PNs in a single cell. That is I have this:

DE 102005039579

CA 2619278

AU 2006281783

WO 2007019845

KR 2008034925

EP 1917004

CN 101299998

JP 2009504688

JP 5512968

EP 2266544

KR 2011094222

IL 189079

CN 102716068

BR 2006014835

RU 2480201

ES 2635493

IN 2008MN00298

IN 247903

US 20080187595

AU 2011236018

US 20120225128

US 20160067338

US 9827312

and I want a new column with one patent number, extracted with kind of a priority table. If a WO number is found, extract this, if not, take the US, if that isn’t found, take EP and so on.

Is that possible?

Thank you.