This is a BNF specification of a valid host name.
First part are defining characters
dot = %x2E ; "." - This is a Dot (Hex Value and its character
alpha = %x41-5A | %x61-7A ; A-Z | a-z - alpha is a letter Upper or Lower case - hex values followed by printed representation
digit = %x30-39 ; 0-9 - the digits (hex and char)
dash = %x2D ; "–" - The dash (hex and char)
This completes the initial defintions. What we know are that only the 10 digits (0-9) and the 26 letters (upper or lower), the dot and the dash are the only valid characters. The remaining rules then specify how they can be combined.
dns-char = alpha | digit | dash - A dns char can be a letter, a digit, or a dash (but not a dot)
id-prefix = alpha | digit - The id-prefix can only be a letter or a digit
label = id-prefix [*61dns–char id–prefix] - A label is an id-prefix (which we know is either a letter or digit) followed one or more (up to 61) dns-chars (which are letters, digits, or a dash) followed by an id-prefix. What this means is that first and last characters may not be a dash, but you can have dashes in the middle.
sldn = label dot label ; not to exceed 254 characters - The sldn consists of a valid label, followed by a dot followed by another label.
hostname = 1*(label dot) sldn; not to exceed 254 characters - A valid hostname then consists of 1 or more of (label dot) sldn. The (label dot) in optional because its in parens. So a valid hostname at least 1 sldn, but you can have a series (0 or more) of label dot string in front of it, up to a maximum of 254 characters.
Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein