Created
June 9, 2025 16:39
-
-
Save DArmstrong87/4e0b54b9b8a1e45bf5644f52750df028 to your computer and use it in GitHub Desktop.
Validate domains and subdomains
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
| const validateDomain = (domain) => { | |
| const domainRegex = /^[A-Za-z0-9-]{1,63}(\.[A-Za-z0-9-]{1,63})*\.[A-Za-z]{2,6}$/mig; | |
| return domainRegex.test(domain) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment