re = /(?P<utm_term>(?<=utm_term=).*?(?=&|\\s|$))/m
str = 'https://www.rover.com/search/?utm_medium=email&utm_source=Responsys&utm_campaign=111017190001&utm_content=2017_11_09_O_TGiving_NoSt_SDTest_NoCoup_2&utm_term=111017'
# Print the match result
str.scan(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