Rails regex to extract Twitpic link/code if present
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 n开发者_运维技巧ame of the site, so the text between http:// and .com "twitpic"
To extract 18744594
only
/http:\/\/twitpic\.com\/(\d+)/
To extract twitpic
and 18744594
/http:\/\/(twitpic)\.com\/(\d+)/
精彩评论