View Full Version : url validation

08-13-2004, 09:50 PM
Hi.... I was searching all night for a url validation script... Do u know any?

Willy Duitt
08-13-2004, 10:11 PM
I do not understand the question....
Can you please elaborate....


08-14-2004, 10:17 AM
The user in a ul textbox enters a url... i want to check if it is valid or not

Matt RW
08-14-2004, 10:35 AM
you mean something like this?

if(form.HomepageURL.match(/^http:\/\/\w+(\.\w+)*\.(\w{2}|com|net|org|mil|int|edu|gov|info|biz|coop|aero|pro|name|museum)(\/[\w\-\.])*$/) == null){
// invalid URL!!
(regexp written on the fly, not tested. Reaplace form.HomepageURL with the string to validate)

<edit>this board inserts two spaces in "a ero" not sure why, remove them</edit>

08-16-2004, 08:10 PM
I wonder if he's asking to check further if the url is not dead.. (it's one thing for a url to be typed in correctly, but if it doesn't point anywhere..)

I'm actually not sure how to do this using Javascript. It may not be possible? I'm sure it can be done using PHP or some other server-side language..