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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find URL Validator
Expression
/^(https?|ftp)(:\/\/)(([\w]{3,}\.[\w]+\.[\w]{2,6})|([\d]{3}\.[\d]{1,3}\.[\d]{3}\.[\d]{1,3}))(\:[0,9]+)*(\/?$|((\/[\w\W]+)+\.[\w]{3,4})?$)/
Description
This expression will test against most URLs and return whether they are valid URL's or not. It will allow some false positives in that it is only checking for the correct character count, but this could be enhanced by adjusting it to check for specific TLDs or file extensions.
Matches
http://www.website.com, http://subdomain.website.com, https://www.website.net/subfolder/subfolder/file.htm, http://www.website.org/subfolder/subfolder/file_weird%20Name$@#.pdf, https://209.165.5.487/about.html
Non-Matches
http://www.missingperiodcom, http:/misssingforwardslash.com, http://www.missingTLD., www.missingHTTP.com
Author Rating: Not yet rated. Harry
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

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