Skip to content

Instantly share code, notes, and snippets.

@ruturajpatki
Last active August 13, 2023 07:33
Show Gist options
  • Select an option

  • Save ruturajpatki/67f93d68768c3be494dd089467ebb164 to your computer and use it in GitHub Desktop.

Select an option

Save ruturajpatki/67f93d68768c3be494dd089467ebb164 to your computer and use it in GitHub Desktop.
VB.Net function to check if the specified domain name is in standard domain name format.
'Imports System.Text.RegularExpressions
Private Function IsValidDomainFormat(domainName As String) As Boolean
Dim pattern As String = "^(?![0-9]+$)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(?:\.[A-Za-z]{2,})+$"
Dim regex As New Regex(pattern)
Return regex.IsMatch(domainName)
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment