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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^([a-zA-Z0-9][-a-zA-Z0-9]*[a-zA-Z0-9]\.)+([a-zA-Z0-9]{3,5})$
Description
Host/Domain name validation for perl. Should be combined with a check for length <= 63 characters and that $2 is in a list of top-level domains.
Matches
freshmeat.net | 123.com | TempLate-toolkKt.orG
Non-Matches
-dog.com | ?boy.net | this.domain
Author Rating: Not yet rated. Nathan Pitts
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: Actually
Name: Remi Sabourin
Date: 6/19/2004 4:26:46 PM
Comment:
More precisely, the end should be {2,6} as "museum is also a valid top level domain See http://regexlib.com/REDetails.aspx?regexp_id=391


Title: Incorrect for country code TLDs
Name: Tony Meyer
Date: 3/26/2003 1:47:35 AM
Comment:
This is not correct. The (3,5) at the end should be (2,5). Country code TLD's tend to be 2 chars long, not 3.


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