PHP: how to grab an URL out of a chunk of text?

Posted by Eileen on Stack Overflow See other posts from Stack Overflow or by Eileen
Published on 2009-03-11T18:47:19Z Indexed on 2010/04/02 14:13 UTC
Read the original article Hit count: 280

Filed under:
|
|
|

Let's say I have a big RSS feed full of Twitter posts, and they are all plain text. Lots of the posts contain URLs, and I'd like those URLs to be turned into links.

So I've got a variable that is equal to:

Visualization of layoffs by industry, number and date. Looking forward to seeing similar for hiring trends. http://bit.ly/XBW4z

And I'd like it to turn into:

Visualization of layoffs by industry, number and date. Looking forward to seeing similar for hiring trends. http://bit.ly/XBW4z

How could I do that? I am useless when it comes to regex and its ilk, so help is much appreciated!

© Stack Overflow or respective owner

Related posts about php

Related posts about regex