pattern for even number of HEX digits using Nick Gammon's Regexp library

RayL:
stowite;

I changed the expression from "(0[xX])?([0-9a-fA-F][0-9a-fA-F])+"

to "0?[xX]?([0-9a-fA-F][0-9a-fA-F])+" and then it worked!

I didn't really need the capture i.e. the parens around '0[xX]'.

The parenthesis are not there to capture the 0x. They are there to group the '0x'. Without them, this expression will match '012', which is not what you want. It will also match 'x12', which is also not what you want.