re = /(?:(?!video).)*video\/(\d+)\//m
str = 'https://www.iesdouyin.com/share/video/7039240821144702223/?region=CN&mid=7039240839087803150&u_code=19ambj1ae&did=MS4wLjABAAAAif33DuCPz8E4TM8ohLFknanLbAaeYNGHZvIMdpUGZBk&iid=MS4wLjABAAAAbcVu-zX1os-3_V1-tnqKfcfhYUGKXPsJhcECdsvolcDBQetzxujmh6J5MwxRPIAa&with_sec_did=1&titleType=title×tamp=1639030688&utm_campaign=client_share&app=aweme&utm_medium=ios&tt_from=copy&utm_source=copy
{START}(?:(?!{END}).)*{END}'
# 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