View Single Post
Old 12-06-2007, 06:36 PM   #19 (permalink)
Matt83
The Contributor
Upcoming Programmer 
 
Matt83's Avatar
 
Join Date: Oct 2007
Location: Argentina
Posts: 72
Thanks: 18
Matt83 is on a distinguished road
Default

Im glad to see how much this thread is progressing. Devolio, i wouldnt mind either to see you credit TalkPHP

Here is another to validate URLS i made yesterday, it's not perfect at all so maybe we can improve it to make it better:

/^(http|https|ftp):\/\/([\w]*)\.([\w]*)\.(com|net|org|biz|info|mobi|us|cc|bz|tv|ws|name |co|me)(\.[a-z]{1,3})?\z/i

PHP Code:
$szString "http://www.talkPHP.com";
if (
preg_match('/^(http|https|ftp):\/\/([\w]*)\.([\w]*)\.(com|net|org|biz|info|mobi|us|cc|bz|tv|ws|name|co|me)(\.[a-z]{1,3})?\z/i'$szString))
    echo 
"This is a valid URL"
__________________
http://www.mattvarone.com

Last edited by Matt83 : 12-09-2007 at 02:31 PM.
Matt83 is offline  
Reply With Quote