reg = {
old: %r<\Ahttps?://[^/]+/system/media_attachments/files/[0-9]{3}/[0-9]{3}/[0-9]{3}/\w+/\w+\.\w+(?:\?\d+)?\Z>,
sug1: %r<\Ahttps?://[^/]+/system/(cache/)?media_attachments/files/([0-9]{3}/)+\w+/\w+\.\w+(?:\?\d+)?\Z>,
sug2: %r<\Ahttps?://.+/media_attachments/files/(?:[0-9]{3}/)+original/[0-9a-f]+\.>
}
tests = [
'https://s3-mstdn.maud.io/cache/media_attachments/files/104/763/965/164/127/360/original/dc900498eba80ca9.jpg',
'https://cloud-ng.rinsuki.net/mstdn-rinsuki-net/media_attachments/files/104/638/699/338/921/178/original/d21fac99c2890a85.png'
]
tests.each do |test|
puts test
p reg.map{|k, r| [k, r.match?(test)] }.to_h
end