Will UIDs always start with "0x"?

I.e. Are UIDs just hexadecimal integers? And is ^0x\w+$ a good regex to validate UIDs?

UIDs are represented by an unsigned integer of 64 bits (uint64). It’s printed with 0x because it’s easier to read hexadecimal numbers when your IDs get large. But you should not rely on it being always printed thus. It may change in the future, who knows.

More to the point - why are you trying to validate UIDs?

why are you trying to validate UIDs?

If a website has routes like test.com/post/:uid, it should show an error message if the uid is invalid.

In that case the UID should be a number.

1 Like

Could also do youtube encoding :slight_smile: (base64encoding but use _- instead of +/)