I am having few URLs as below and I want to check whether they match a regex or not.
URLs
https://www.amazon.in/Fire-Boltt-Display-Sports-Smartwatch-Tracking/dp/B09YV4RG4D
https://www.amazon.in/Fire-Boltt-Display-Sports-Smartwatch-Tracking/dp/B09YV4RG4D/
https://www.amazon.in/Fire-Boltt-Display-Sports-Smartwatch-Tracking/dp/B09YV4RG4D?tag=goog-21&linkCode=ogi&th=1&psc=1
https://www.amazon.in/dp/B087FXHB6J?tag=goog-21&linkCode=ogi&th=1&psc=1
https://www.amazon.in/dp/B087FXHB6J
Regex
/(https:\/\/www.amazon.in\/)([A-Za-z0-9-_]{0,}\/?)(dp\/[a-zA-z0-9]{0,})(\/?)(\??)/gm
Here is the test results from browser console
and from https://regex101.com/
My question is, What I am doing wrong as 2nd and 4th scenarios are failing?