- The first Regular Expression Library on the Web!

Please support RegExLib Sponsors


Regular Expression Details

Title Test Find Pattern Title
Matches URLS that start with numbers and any TLD that is 2 to 6 characters long. Matches most URLs. Thanks to eveyone for suggesting modifications! UPDATES::[Nov. 11, 2005] Now it matches uppercase and lower case protocols. Updates::December 3, 2005 Added restriction to ports since they will only go up to 65535. (Thanks lorello) Keep the suggestions coming! Thanks for the heads up!!
hTtP:// | |
http://foobar | lameurl.toolongtld
Author Rating: The rating for this expression. Phil Cogbill
Your Rating
Bad Good

Enter New 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: Missing other protocols
Name: t-a-g
Date: 7/15/2008 10:38:50 AM
This is a pretty good Reg Ex for URLs. It does not support an IP address instead of a URL, which would be a nice enhancement. Thanks for your work, time, and creativity.

Title: working just fine
Date: 3/4/2007 2:07:52 PM

Title: Port number
Name: lorello
Date: 12/1/2005 2:54:07 PM
Thanks for your work, I've changed it only in port number patter, substituting (\:[0-9]+) with (\:[0-9]{1,5}) because I cannot have more than 65535 ha a port number.

Title: Now supports upper case and lower case protocols
Name: Phil Cogbill
Date: 11/11/2005 6:09:53 PM
Thanks for the heads up on that. I updated the expression to support HTTP, HtTPs, FTp, FTpS, etc. etc. I've tried this with PHP's posix regular expression funtions and it seems to work good. Any luck with ASP? I don't have any experience with it.

Title: Re: Upper Case Protocols
Name: Case
Date: 11/16/2004 8:11:17 AM
"What about URLs that start with upper-case HTTP:// etc?" Use a case-insensitive check...

Title: Upper Case Protocols
Name: Diplo
Date: 9/22/2004 9:31:05 AM
What about URLs that start with upper-case HTTP:// etc?

Title: Great URL validator
Name: Gregory Long
Date: 8/12/2004 2:07:52 PM
This has been a boon to us. This does a good job of validated a wide variety of URLs. Thanks.

Title: Nice for urls with first character for number.
Name: Phil Cogbill
Date: 6/20/2004 9:23:23 PM
This has been a life saver for some out of sorts urls and the newer TLDs.

Copyright © 2001-2018, | ASP.NET Tutorials