note 24197 deleted from function.preg-match by irchtml
| From: | irchtml@php.net | Date: | Wed, 25 Feb 2004 13:37:56 +0000 |
| Subject: | note 24197 deleted from function.preg-match by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65710@lists.php.net to get a copy of this message | ||
Note Submitter: josh, endquote, com
----
[Editor's note: parse_url() will be simpler and faster]
Mr Ravis above's expression works great, but he left out one more possible part of a url. The
anchor, like what follows a # sign at the very end. This includes it:
preg_match("/^((.*?):\/\/)?(([^:]*):
([^@]*)@)?([^\/:]*)(:([^\/]*))?
([^\?#]*\/?)?(\?([^?#]*))?(#(.*))?$/", $oURL->url, $aURL);
list(,, $sProtocol,, $sUsername, $sPassword, $sHost,, $iPort, $sPath,, $sQuery,, $sAnchor) = $aURL;