Reply to Re: How to extract domain from string with regex?

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация