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/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php