Amen to that. Of course substr($hoststr, strrpos('.', $hoststr)+1)
will get you the characters immediately following the last . character
in the string. Now show me how you prove it's a top-level domain!
(Especially now the naming schema has been relaxed).
On Jan 27, 9:06 am, Matias Gertel <[email protected]> wrote:
> Be really carefull when using code wich assumes certain conditions!
> Why this regular expersion will fail half of the time:
> - It assumes the url starts with www. Wrong! eg: mail.google.com
> - It assumes the url has 4 parts. Wrong! eg:www.google.com
> - It assumes the 3rd part has 2 characters. Wrong: eg:www.google.com.au
> - It assumes the 4th part has 2 characters. Wrong! eg:www.maps.google.com
>
> Any of the other examples provided in this thread will work as a
> charm, but the errors above are common in people who concentrate on
> solving one example instead of thinking about the big picture.
--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---