8

I looked up couple of questions on SO, which seem to suggest that two continuous hyphens (e.g. my--website.com) are not allowed but when I search for same domain name on http://www.register.com/index.rcmx, it gladly accepts the name while rejects non valid domain names like my#website.com.
Validation for URL/Domain using Regex? (Rails)

Community
  • 1
  • 1
RandomQuestion
  • 6,778
  • 17
  • 61
  • 97

4 Answers4

13

It's legal in a domain name, and required for internationalised domain names (IDNs) which when converted from Unicode to ASCII end up prefixed with xn--

Alnitak
  • 334,560
  • 70
  • 407
  • 495
8

In general double hyphens are allowed. However, in your specific example, it should not be possible, because they may not occur on the third and fourth position except when writing IDN labels in their xn-- notation. See the following section from RFC 5891:

4.2.3.1. Hyphen Restrictions

The Unicode string MUST NOT contain "--" (two consecutive hyphens) in the third and fourth character positions and MUST NOT start or end with a "-" (hyphen).

Michael
  • 202
  • 2
  • 8
2

Some TLDs allow as many consecutive dashes as you want, others seem to have specific rules about their positioning.

This is a working website: l-------------------------------------------------------------l.tk (mirror)

The universal rules are:

  1. Not in the 3rd and 4th position, except as part of an IDN
  2. Not at the beginning or end

Nothing else can be counted on unless you thoroughly test each individual TLD.

dandwyer
  • 21
  • 3
-1

It must be "allowed", regardless of the answers here, because https://hp--community.force.com exists. However, perhaps that's only okay because it's a subdomain of a registered domain, and not a registered domain in itself.

Dan
  • 9
  • 1
    I'm quite sure the rules for subdomains are different - and less restrictive - than the ones for domain names. – Jan Aagaard Jan 09 '20 at 08:26