|
Posted by deko on 02/12/07 08:57
As I understand it, the characters that make up an Internet domain name can
consist of only alpha-numeric characters and a hyphen
(http://tools.ietf.org/html/rfc3696)
So I'm trying to write regex that will provide a basic url format validation:
starts with http or https (the only 2 prots I'm interested in), is followed by
'://', then ([any alpha-numeric or hyphen] followed by a '.' appearing 1 or more
times), then followed by anything *, and is case-insensitive.
I tried this:
if (preg_match('/^(http|https):\/\/([a-z0-9-]\.+)*/i', $urlString))
{
$valid == true;
}
else
{
$valid == false;
}
but no luck.
Any suggestions welcome...
Thanks in advance.
Navigation:
[Reply to this message]
|