Last active
August 13, 2023 07:33
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| '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