我有一个类似于此的字符串:
|image: http://product_image.png |product: http://product_url.html
所以,这个模式是:收图: URL收产品: URL。
如何在Ruby中找到这两个URL?
发布于 2013-10-16 17:19:42
试试这个正则表达式:
regex = /image: (.+) \|product: (.+)/
result = regex.match("|image: http://product_image.png |product: http://product_url.html")
puts result[1] # http://product_image.png
puts result[2] # http://product_url.html
https://stackoverflow.com/questions/19416642
复制相似问题