I am using python and would like a simple api or regex to check for a domain name’s validity. By validity I am the syntactical validity and not whether the domain name actually exists on the Internet or not.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Any domain name is (syntactically) valid if it’s a dot-separated list of identifiers, each no longer than 63 characters, and made up of letters, digits and dashes (no underscores).
So:
would be a start. Of course, these days some non-Ascii characters may be allowed (a very recent development) which changes the parameters a lot — do you need to deal with that?