开发者

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+)/
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜