我有一个字符串:
abchghhdgfdgfdfdfhttp://www.rajasthanpatrika.com/News/World/1132013/international news/414309\r\n\t\t\t\t ghjghjfhjvfhjhfj"
我想提取网址:
http://www.rajasthanpatrika.com/News/World/1132013/international news/414309
我该怎么做?
答案 0 :(得分:1)
s = "abchghhdgfdgfdfdfhttp://www.rajasthanpatrika.com/News/World/1132013/international news/414309\r\n\t\t\t\t ghjghjfhjvfhjhfj"
s[/http:\/\/.*?(?=[\r\n\t])/]
# => "http://www.rajasthanpatrika.com/News/World/1132013/international news/414309"