Will UIDs always start with "0x"?

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

1 Like

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?

1 Like

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.

1 Like

In that case the UID should be a number.

2 Likes

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

1 Like