在 Ruby 1.8 中,使用 URI 标准库,我可以解析
http://au.easyroommate.com/content/common/listing_detail.aspx?code=H123456789012&from=L123456789012345
用来URI.split
得到
["http", nil, "au.easyroommate.com", nil, nil,
"/content/common/listing_detail.aspx", nil,
"code=H123456789012&from=L123456789012345", nil]
但是是否可以在H123456789012
不使用我自己的hackery的情况下从查询部分获取位(例如,拆分&
然后获取匹配的位/code.(.*)/
?