RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Host name
Expression
[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*(?:\.[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)*
Description
Multi-part host name validator, RFC-compliant but does not validate length of components or overall length
Matches
localhost www.example.com host-1234.example.com
Non-Matches
localhost. -1234.example.com
Author Rating: The rating for this expression. Kevin Dean
Source
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Some Errors
Name: Anon
Date: 10/24/2014 2:21:30 AM
Comment:
Doesn't work for - xn--foo.com (IDN) - foo---bar---baz.com (Yes, this is valid.) - foo.com. (Trailing dot. Yes, this is valid.) - foo_bar.baz.com (Underscore, have only seen this at freehosters)


Copyright © 2001-2018, RegexAdvice.com | ASP.NET Tutorials