On Mon, Sep 21, 2009 at 12:52:12PM -0300, Jônatas Zechim wrote:

> Hi there, i've the following strings:
> $string1 = 'Lorem ipsum dolor http://site.com sit amet';
> $string2 = 'Lorem ipsum dolor http://www.site.com/ sit amet';
> $string3 = 'Lorem ipsum dolor http://www.site.net sit amet';
> How can I extract the URL from these strings?
> They can be [http:// + url] or [www. + url].

Use the preg_match() function (see
http://us2.php.net/manual/en/function.preg-match.php ) and a good
regular expression from a place like http://www.regexlib.com/ .


Paul M. Foster

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to