Reply to Re: URL Validate

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация