I am validating a string whether it is hexadecimal or not using regular expression.
The expression I used is ^[A-Fa-f0-9]$. When I using this, the string AABB10 is recognized as a valid hexadecimal, but the string 10AABB is recognized as invalid.
How can I solve the problem?
You most likely need a
+, soregex = '^[a-fA-F0-9]+$'. However, I’d be careful to (perhaps) think about such things as an optional0xat the beginning of the string, which would make it^(0x|0X)?[a-fA-F0-9]+$'.