|
Posted by Alvaro G. Vicario on 12/17/43 11:56
*** deko escribió/wrote (Fri, 25 Aug 2006 23:09:28 -0700):
> In these strings, domains are always preceded by
> "http://" or "http : //www" (without the spaces).
Without the spaces? Then, why do you add the spaces?
Given that precondition, I wouldn't use regex:
parse_url Parse a URL and return its components
usage:
array parse_url ( string url )
Parameters
url
The URL to parse
Return Values
On seriously malformed URLs, parse_url() may return FALSE and emit a
E_WARNING. Otherwise an associative array is returned, whose components may
be (at least one):
scheme - e.g. http
host
port
user
pass
path
query - after the question mark ?
fragment - after the hashmark #
> in pseudo code, I thought it might look like this:
>
> if (eregi("http: //", $mystring))
Sorry, but I just can't understand all that story about spaces/not spaces
:-?
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
[Back to original message]
|