0

I have this these kinds of Amazon URLs and I want to extract ASIN from them

  1. https://www.amazon.com/RESCUE-Outdoor-Non-Toxic-Reusable-Attractant/dp/B07VDN12QX/ref=pd_day0fbt_sccl_1/138-2138307-6591363?pd_rd_w=L4jvw&content-id=amzn1.sym.fb2f9869-6657-4645-bf3b-01bcc75765ec&pf_rd_p=fb2f9869-6657-4645-bf3b-01bcc75765ec&pf_rd_r=1W2ZA66NTRVS760ZRZX5&pd_rd_wg=uKxPh&pd_rd_r=dd5f6632-2311-4f12-b701-184c02b5ad39&pd_rd_i=B07VDN12QX&psc=1

  2. https://www.amazon.com/gp/slredirect/picassoRedirect.html/ref=sspa_dk_detail_6?ie=UTF8&adId=A06306412QSO2QHC1E29S&qualifier=1664214292&id=892620518584137&widgetName=sp_detail_thematic&url=%2Fdp%2FB09XHYXH4K%2Fref%3Dsspa_dk_detail_6%3Fpsc%3D1%26pd_rd_i%3DB09XHYXH4K%26pd_rd_w%3DN7NuD%26content-id%3Damzn1.sym.3481f441-61ac-4028-9c1a-7f9ce8ec50c5%26pf_rd_p%3D3481f441-61ac-4028-9c1a-7f9ce8ec50c5%26pf_rd_r%3D1W2ZA66NTRVS760ZRZX5%26pd_rd_wg%3DuKxPh%26pd_rd_r%3Ddd5f6632-2311-4f12-b701-184c02b5ad39%26s%3Dmerchant-items%26sp_csd%3Dd2lkZ2V0TmFtZT1zcF9kZXRhaWxfdGhlbWF0aWM%26smid%3DA1RU2NZDC9WNW9

I have been using this REGEX - (?:[/dp/]|$)([A-Z0-9]{10}) from here https://regexr.com/3gk2s but I'm still not getting the desired result

Smith O.
  • 217
  • 4
  • 16

1 Answers1

0

the correct regex is this: (?:[/dp/]|$)([A-Z0-9]{10})

Billy Jhon
  • 1,035
  • 15
  • 30