How to extract the ASIN number from the amazon?

Link1: Mamaearth Perfume Body Mist for Babies and Kids with Allergen Free Jasmine Fragrance for All Day Freshness 150 ml : Amazon.in: Baby Products

Link2: Lavie Sport Camo 34 Ltrs Casual Backpack | School College bag for Boys & Girls (Navy) : Amazon.in: Fashion

what i need is to extract the ASIN number from particular products but everytime the position is getting changed of the ASIN number
how to extract the ASIN number if any one of the format comes. main goal is to extract the ASIN number

Hi @Vinit_Mhatre

Can you try using Regular Expression to achieve your goal?

Thank you.

Here is RegEx Pattern for your requirement.

Extract the entire string as stored it in a variable then apply the below pattern, It will work with both the cases I seen in the initial post.

image

Note: Trim any empty spaces on both ends if needed.

Hope this will be helpful. Thank you.

tst.txt (843 Bytes)
This is my extracted file can you give me the regex to extract the ASIN number from this… ASIN number should be only 10 char. so also add the limit of 10 char in regex
Thanks

Hi @Vinit_Mhatre,

Can you try using Regular Expression for your solution.

System.Text.RegularExpressions.Regex.Match(str,“(?<=ASIN :\s)[A-Za-z0-9]{10}”).Value.Trim