check if a string is a valid hexadecimal number