Regex groups for cloudinary url

  cloudinary, javascript, regex

I’m trying to capture different parts of a url while ignoring parts that sometimes comes up.

I’ve tried using and extending the regex found here with little luck.

Take the example,c_fill,f_auto,g_auto,w_700/v1619174590/folder/path/cjtdn73cleqagpy4fqza.jpg : host
test-site : cloudname
upload/facebook: resource_type
id: v1619174590/rg/collective/media/cjtdn73cleqagpy4fqza.jpg

I need to ignore everything between /upload/ and /v, I’ve accomplished this using //upload/.*?b(?=v1)/ , but it doesn’t account for if the resource type is facebook and there is no /v123

Source: Ask Javascript Questions