I didn't understand why does the parser find only 0x ??
I thought this:
given the input string from the question,
"0x12 0x 0 x3abc ab23 0Xfm"
then (starting from index 0)
1) Required 0 -> Found "0"
Required x -> found "x"
Attempt for (digit | smallAlpha | bigAlpha) -> found "1"
So at this point the first captured (and consumed) token should be 0x1.
Then it rejects the "2" and " " until it finds "0" again.
2) "0x" (it also reads a " "(space) which doesn't match with [0-9a-fA-F]?, but since this is terminated
by the '?' quantifier it moves on to the next match);
3) Finally, by the same principle it should find "0Xf".
To sum up, it should find "0x12", "0x" and "0Xf". I also tried to execute this search in a program and it matches my description.