note 18332 added to function.preg-match

From: Date: Fri, 18 Jan 2002 17:36:56 +0000
Subject: note 18332 added to function.preg-match
Groups: php.notes 
Request: Send a blank email to php-notes+get-25052@lists.php.net to get a copy of this message
To split a host, you can use this expresion. preg_match("/^(.+:\/\/)?([^:]+):?([0-9]+)?(.*)/", $url, $match); list(,$proto,$host,$port,$file) = $match; Meaning: starts with, possibly, one or more letters, followed by "://" (protocol), one or more letters, but a colon (host), possibly a colon, followed by the posibility of one or more numbers (port), and any number of trailing chars, (file/query). -- http://www.php.net/manual/en/function.preg-match.php http://master.php.net/manage/user-notes.php?action=edit+18332 http://master.php.net/manage/user-notes.php?action=delete+18332 http://master.php.net/manage/user-notes.php?action=reject+18332

« previous php.notes (#25052) next »