Posted by Jerry Stuckle on 08/08/06 11:31
lorento wrote:
> $uri = 'http://some-domain-name.org';
> if( preg_match(
> '/^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}'
> .'((:[0-9]{1,5})?\/.*)?$/i' ,$uri))
> {
> echo $uri . ' is a valid url';
> }
> else
> {
> echo $uri . ' is NOT a valid url';
> }
>
> --
> http://www.nusaland.com
> http://uk.nusaland.com
>
> rohit wrote:
>
>>any body can help me to provide the code for URL validate thru PHP
>
>
I'm not a regex expert (barely a beginner) - but two problems with this one.
A uri does not include http or https. That is the protocol being used.
It could be ftp://, for instance.
And this one will fail with some tlds, such as museum.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|