Re: Checking for HTTP:// at the start of a string and more ////

From: Date: Sat, 01 Mar 2003 14:04:59 +0000
Subject: Re: Checking for HTTP:// at the start of a string and more ////
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-137688@lists.php.net to get a copy of this message
At 05:09 01.03.2003, Philip J. Newman said: --------------------[snip]-------------------- >I would like to check for HTTP:// at the start of a string and for at least >1 . and a / at the end of a string. > >I have tried ereg, but the documentation is not too clear how to format. --------------------[snip]-------------------- Untested: if (preg_match('/^http:\/\/[^\.\s]+\.[^\s]+\/$/i', $string)) // valid string else // invalid string Should match a string beginning with 'http://', followed by one or more characters that are no dots or whitespace, followed by a dot, followed by one or more characters that are not whitespace, and terminated with a slash. The terminating 'i' makes the search case insensitive. -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/

« previous php.general (#137688) next »