Rails regex to extract Twitpic link/code if present

Posted by Rabbott on Stack Overflow See other posts from Stack Overflow or by Rabbott
Published on 2010-04-28T04:13:53Z Indexed on 2010/04/28 4:23 UTC
Read the original article Hit count: 359

Filed under:
|
|

Provided a url, within a string of text (tweet) such as

"Check out my twitpic http://twitpic.com/1876544594 its awesome"

I need a Rails regex that will return 18744594, the id of this particular twitpic...

This question has been asked here but was for PHP, and I need it for Rails.

I would also be able to pull the name of the site, so the text between http:// and .com "twitpic"

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about twitpic