Re: string manipulation
| From: | Fredrik de Vibe | Date: | Wed, 19 Feb 2003 00:29:58 +0000 |
| Subject: | Re: string manipulation | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-25745@lists.php.net to get a copy of this message | ||
dziuram@hotmail.com (Martin Dziura) writes:
> is there some sort of parsing call i can evoke to extract the url?
> Beginning with the http and ending with the first white space?
$str = "foobarbazhttp://www.foo.bar/";
preg_match("/(http:\/\/\S+)/", $str, $match);
$match[1] should contain the url part of $str. There are more
sophisticated regular expressions you can make for extracting url's,
but from your description, I think this should be enough.
--
--Fredrik
"Calvin Coolidge looks as if he had been weaned on a pickle."
-- Alice Roosevelt Longworth