re = /\/o\/([a-zA-Z0-9]+)\/([a-zA-Z0-9-]+)/i
str = 'https://firebasestorage.googleapis.com/v0/b/geographical-memories-dev.appspot.com/o/Fa4NPIoM5sON70uDJjufgnL5DHY2/01792dcc-4963-4658-a3d0-99073b352e22?alt=media&token=23676a66-ed8d-4b43-9150-6ef3f07544f0
https://firebasestorage.googleapis.com/v0/b/geographical-memories-dev.appspot.com/o/Fa4NPIoM5sON70uDJjufgnL5DHY2/01792dcc-4963-4658-a3d0-99073b352e22?alt=media&token=80a5cc0f-7943-4ef8-ab00-9bef8acd41bf'
# 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