I really didn't want to ask this here as I'm sure this will get me downvoted, but I truly am stuck.
I have used multiple tools to test regex expressions but the syntax is very confusing.
What I have tried
I am going to be using javascript for this, I have the following string for example:
Product ID: 4381 - Fanta Berry cans 355ml x 24
This is a search result from an autocomplete dropdown, it will always have the format:
Product ID: product_id - Product Name
Now I need to get the product_id the number between the : and -
I have tried
/[\d]/g
But that simply selects all the numbers in the string.
I also tried:
[(:\b)-]
And that selects the : and - which are the characters between the number I want to get. But I can't seem to figure out the syntax to get the number between them. I feel like I'm very close but after hours of searching I can't seem to crack it, I know this isn't a place for people to do the work for you, but I assure you I have tried and am really at a loss! If anyone can tell me the little bit of syntax that's missing to get that number I would be very appreciative.