Regex for Domain Name

escape . only once, and remove space inside the curly brackets and it works.

iex> ~r/^((?!-)[A-Za-z0-9-]{1,63}(?<!-)\.)+[A-Za-z]{2,6}$/ |> Regex.match?("domain-name.domain-name.ext")
true