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

stowite;
Here is the complete sketch which fails with "(0[xX])?([0-9a-fA-F][0-9a-fA-F])+".
You'll notice I also have a line (comented out) using "0?[xX]?([a-fA-F0-9][a-fA-F0-9]+)".
I agree that "it allows the hex values to be prefixed by 'x' or 'X' or '0' or "0x" or "0X". "

I would rather understand how to do it correctly.

#include <Regexp.h>
char buf [100]="";  // large enough to hold expected string

void setup () {
  Serial.begin(9600);
  MatchState ms;

char tgt1[] = "ATS ULTRALIGHT ;0xfe";
char pat1[] = "([Aa][Tt][Ss])%s+(ULTRALIGHT) ;(0[xX])?([0-9a-fA-F][0-9a-fA-F])+";
//char pat1[] = "([Aa][Tt][Ss])%s+(ULTRALIGHT) ;0?[xX]?([a-fA-F0-9][a-fA-F0-9]+)";

ms.Target (tgt1);  // what to search
char result = ms.Match (pat1, 0);

if (result == REGEXP_NOMATCH) Serial.println("NO MATCH");
else {
    Serial.print("MATCH -- Nr. Captures: ");
    Serial.println (ms.level);

    for (int i = 0; i < ms.level; i++) {
        Serial.print ("Capture #: ");Serial.println (i, DEC);
        Serial.print ("Text: '");Serial.print (ms.GetCapture (buf, i));
        Serial.println ("'");
    }
    Serial.print ("Matched on: ");
    Serial.println (ms.GetMatch (buf));
    }
} // end of setup

void loop () {}