Regex - Get ID from URL

Hi all,

Does anyone know a good regex to extract the following ID number from the URL?

https://www.shutterstock.com/video/clip-1076280362-bullet-casing-falling-wet-ground-crime-scene

I appreciate all the help! I’ve been searching and testing but can’t crack this one.

Hi there, @rosshelton… if the format is always the same, you could use Bubble’s :split by operator, with the character to split by being a dash. Then, add the :item # operator to the end of the expression and set the item number as 2, and you should get the ID number in return.

Hope this helps.

Best…
Mike

Thanks Mike!

I’m trying to achieve the the whole thing using regex. I will have multiple url types with IDs in different places. I will need to use the same extract with Regex workflow but with a different regex patterns for the different URLs.

I appreciate your thought!

1 Like

Okay, I will give it one more shot.

I don’t pretend to be a regex expert, but a quick text using the :extract with Regex operator on your URL with the super simple regex of [0-9]+ extracted the ID number. If’ that’s not what you need, then I’m out. :slight_smile:

It’s possible that the name may have numbers in them.

https://www.shutterstock.com/video/clip-1076280362-bullet-casing-falling-wet-ground-crime-

Although, maybe that is the winner. It seems to only match the first instance. :grinning:

1 Like

Another quick test on this end shows that it will find additional strings of numbers, and they will be comma separated. So, if you add the :first item operator to the end of the expression, you could have what you need.

2 Likes

I was just seeing the same. I think the first item trick might be a winner on this!

Thanks so much!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.