|
Posted by Rik on 02/09/07 21:14
On Fri, 09 Feb 2007 22:02:18 +0100, BKDotCom <bkfake-google@yahoo.com> =
wrote:
> On Feb 9, 2:15 pm, "deko" <d...@nospam.com> wrote:
>
>> Are there any PHP functions that will help here? How to handle sub =
>> domains?
>> International domains?
>>
>> Thanks in advance.
>
> well, you found parse_url
> you might want to use regular expressions as well
>
> $long_string =3D 'A HREF=3D"http://something.else.example.com/blah/?
> joe=3Dbob"';
> if ( preg_match('|([^\s"\']*://[^\s"\']*)|',$long_string,$matches) )
Afaik protocols can only be a-z+, you don't have to capture the entire =
match, and the url should have at least one character, so a little =
optimised it would be:
'|[a-z]+://[^\s"\']+|i'
> {
> $url =3D $matches[1]; // http://something.else.example.com/blah/?
> joe=3Dbob
$url =3D $matches[0];
-- =
Rik Wasmus
Navigation:
[Reply to this message]
|