Title |
Test
Find
Validate URL
|
Expression |
^((http://)|(https://))((([a-zA-Z0-9_-]*).?([a-zA-Z0-9_-]*))|(([a-zA-Z0-9_-]*).?([a-zA-Z0-9_-]*).?([a-zA-Z0-9_-]*)))/?([a-zA-Z0-9_/?%=&+#.-~]*)$ |
Description |
A regex I came up with for validating urls, didn't test thoroughly but seems to do the trick. |
Matches |
http://sportsalert.net, https://www.sportsalert.net, http://sportsalert.net.uk, http://sportsalert.net/index.html, http://sportsalert.net/subdirectory, http://sportsalert.net?var1=param1&var2=param2 |
Non-Matches |
www.sportsalert.net, http://.sportsalert.net, http://sportsalert..net |
Author |
Rating:
Justin Toth
|
Source |
|
Your Rating |
|
Title: Bad validation
Name: MDG
Date: 10/7/2007 10:12:38 AM
Comment:
It accepts http:// as a link and http://www.foo as a link.
Not really useful. SHould require at lease a site name and a .something.
Title: Problem with the URL validation
Name: Rex Steve
Date: 9/28/2007 4:13:48 AM
Comment:
What if the Url contains a : in querystring argument.
Title: Problem with the URL validation
Name: Rex Steve
Date: 9/28/2007 2:48:38 AM
Comment:
What if the Url contains a : in querystring argument.