We have been tasked with coming up with a regex that matches both integer and hexadecimal numbers (a number starting with '0x' followed by any combination of letters (a-f) and numbers).
Should match:
- 0xa9bf
- 42
Should not match:
- a9bf
- 0xg
What we have tried so far:
([0-9]+)|(0x[0-9a-fA-F]+)
This does not work however. Any suggestions to how we can improve?