note 18332 modified in function.preg-match by irc-html

From: Date: Fri, 18 Jan 2002 19:45:42 +0000
Subject: note 18332 modified in function.preg-match by irc-html
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-25061@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). --was-- 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

« previous php.notes (#25061) next »