re = /https:\/\/tld\.example\.com(.*?)ref=testetghe/
str = 'icon-459822882 attributeIcon-1499443538" focusable="false" height="100%" role="img"
width="100%"><use xlink:href="#icon-clipboard"></use></svg><dl class="itemAttribute-1164924913"><dd
class="attributeValue-3783238563"><a class="attributeLink-387024144" rel=" noopener noreferrer"
href="https://tld.example.com/en/main?id=325235231763265&ref=testetghe"
title="Opens in a new window." target="_blank'
# Print the match result
str.match(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html