Explore Courses Blog Tutorials Interview Questions

1 Answer

0 votes
by (44.4k points)

So normally, they would look like this and the last part of the URL is the ASIN:

So, try this code:

var url = "";

var regex = RegExp("[\\w-]+/)?(dp|gp/product)/(\\w+/)?(\\w{10})");

m = url.match(regex);

if (m) { 

    alert("ASIN=" + m[4]);


Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

Browse Categories