(0[xX])?([A-Fa-f0-9][A-Fa-f0-9])+$
Old joke: "You have a problem. So you write a regex. And now you have two problems."