如何在ruby中从这个URL提取glid参数的值?

如何在ruby中从这个URL提取glid参数的值?,ruby,Ruby,您可以使用字符串拆分方法。最简单的方法 ruby-1.9.2-p290 :004 > a = 'http://share.findmespot.com/shared/faces/viewspots.jsp?glId=0rEE45o3ERRryMevW5teqS9gkNI' => "http://share.findmespot.com/shared/faces/viewspots.jsp?glId=0rEE45o3ERRryMevW5teqS9gkNI" ruby-1.9.2-p

您可以使用字符串拆分方法。最简单的方法

ruby-1.9.2-p290 :004 > a = 'http://share.findmespot.com/shared/faces/viewspots.jsp?glId=0rEE45o3ERRryMevW5teqS9gkNI'
 => "http://share.findmespot.com/shared/faces/viewspots.jsp?glId=0rEE45o3ERRryMevW5teqS9gkNI" 
ruby-1.9.2-p290 :005 > b = a.split('=')[1]
 => "0rEE45o3ERRryMevW5teqS9gkNI" 

检查此答案,您可以在那里找到多个解决方案: