re = /.*\/profile\/documents\/[a-f\d]{8}-[A-f\d]{4}-4[A-f\d]{3}-[89ab][a-f\d]{3}-[a-f\d]{12}$/m
str = 'http://localhost:3000/profile/documents/8ce825b7-b8c2-468b-a4c8-88eedea5b4c2
http://127.0.0.1/49943/profile/documents/8ce825b7-b8c2-468b-a4c8-88eedea5b4c2'
# 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