Regular expression - URL validator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I found this regular expression on a web site.
It is basicaly an URL validator.

I'm trying to implement this in my web site, but i receive errors.

I think this is a PERL REGEX so what should i do to make it work in php?


$valid =
(preg_match('^((((H|h)(T|t)|(F|f))(T|t)(P|p)((S|s)?))\://)?(www.|[a-zA-Z0-9]
.)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,6}(\:[0-9]{1,5})*(/($|[a-zA-Z0-9\.\,\;\?\'\\\
+&%\$#\=~_\-]+))*$', $_POST['website']));

if ($valido == 0) {
    something here;
    }
else {
    something else here;
    }


Thanks a lot in advance,
Wagner.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux