|
-
May 25th, 2006, 08:58 AM
#1
Thread Starter
PowerPoster
regex to validate URL[solved]
Hi.
I found a few regex on the net to validate a url however it doesnt quite work for me.
I want to make sure that the url is validate on this condition:
optional 'www' beginning
ends with a . (we do not care about if it ends in co.uk or com as in the future who knows what other domains will be available)
any ideas?
I also want to make sure that something like this is invalid:
spaces in the url
http://.xxxxxx
that dot should not be there...invalid url
the one I am currently using which appears to work reasonably is this one however it does have it's flaws.
^(http|ftp)://(www\.)?.+\.
Last edited by Techno; May 25th, 2006 at 10:27 AM.
-
May 25th, 2006, 10:27 AM
#2
Thread Starter
PowerPoster
Re: regex to validate URL
this one seems to work:
^http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$
got it from:
http://regexlib.com
good site for regex!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|