Re: [PHP] Still REG EX

2002-03-25 Thread liljim
Have a look at this: function ValidateUrl($url) { // Check the syntax if (!preg_match("!((https?|ftp)://)(www\.)?([a-zA-Z0-9/\-]*)+\.([a-zA-Z0-9/\-]* )+([a-zA-Z0-9/\-\.]*)?!", $url)) { return false; } // If it's correct, then try and open it if (!@fopen($url, "r")) { return false; }

Re: [PHP] Still REG EX

2002-03-23 Thread Jim Lucas [php]
what are you trying to do? Jim Lucas www.bend.com - Original Message - From: "John Fishworld" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, March 23, 2002 4:33 PM Subject: [PHP] Still REG EX > I'm still playing about trying to validate

Re: [PHP] Still REG EX

2002-03-23 Thread Miguel Cruz
On Sun, 24 Mar 2002, John Fishworld wrote: >> On Sun, 24 Mar 2002, John Fishworld wrote: >>> I'm still playing about trying to validate an url >>> www(dot)something(dot)something ! >>> >>> I thought this would work but know >>> >>> if (ereg("^(w{3})(\\.)([a-zA-Z]+)(\\.)([a-z]{2,4})$", $str)) >> >>

Re: [PHP] Still REG EX

2002-03-23 Thread John Fishworld
Okay good point but still why doesn't it work ? thanks john > On Sun, 24 Mar 2002, John Fishworld wrote: > > I'm still playing about trying to validate an url > > www(dot)something(dot)something ! > > > > I thought this would work but know > > > > if (ereg("^(w{3})(\\.)([a-zA-Z]+)(\\.)([a-z]{2,

Re: [PHP] Still REG EX

2002-03-23 Thread Miguel Cruz
On Sun, 24 Mar 2002, John Fishworld wrote: > I'm still playing about trying to validate an url > www(dot)something(dot)something ! > > I thought this would work but know > > if (ereg("^(w{3})(\\.)([a-zA-Z]+)(\\.)([a-z]{2,4})$", $str)) First of all, web server hostnames don't need to start with

[PHP] Still REG EX

2002-03-23 Thread John Fishworld
I'm still playing about trying to validate an url www(dot)something(dot)something ! I thought this would work but know if (ereg("^(w{3})(\\.)([a-zA-Z]+)(\\.)([a-z]{2,4})$", $str)) can anyone explain why not ??? ^(w{3}) = three w at start of string ?? (\\.) = literal dot ?? ([a-zA-Z]+) match