草庐IT

techcrunch

全部标签

ruby-on-rails - 给定一个 URL,我怎样才能只得到域?

给定的URL如下:http://online.wsj.com/http://online.wsj.com/article/SB10001424052970204409004577158764211274708.htmlhttp://www.techcrunch.com/2012/01/13/techcrunch-coo/使用Ruby/Rails,我怎样才能只返回域?online.wsj.comonline.wsj.comtechcrunch.com没有协议(protocol),没有斜杠,只有子域(如果不是www)、域和分机? 最佳答案

php - 使用php获取字符串中的所有url

我正在尝试找出一种从文本字符串中获取URL数组的方法。文本将采用如下格式:Somerandomtextupherehttp://techcrunch.com/2012/07/20/kickstarter-flashr-wants-to-make-the-iphones-bezel-a-massive-notification-light/?grcc=88888Z0ZwdgtZ0Z0Z0Z0Z0&grcc2=835637c33f965e6cdd34c87219233711~1342828462249~fca4fa8af1286d8a77f26033fdeed202~510f37324b1