orbital 15 Posted October 13, 2012 Report Share Posted October 13, 2012 I want to extract the asin number from an amazon url so http://www.amazon.com/exec/obidos/asin/BGHT0005/trackingid-20 the asin would be BGHT0005 I want to extract the asin from the above amazon url and add ##### after the asin. I know I can do this with $replace but think it would be cleaner with regex. Thanks for the help Quote Link to post Share on other sites
orbital 15 Posted October 15, 2012 Author Report Share Posted October 15, 2012 thanks willywonka for your help. I ended up watching some tutorials and found I could get the asin by this regex: B\w+ so something like this: set(#asin, $find regular expression($scrape attribute($element offset(<class="getbook">, #counter), "href"), "B\\w+"), "Global") then I just append the pound signs to the end of it in the set command or when I add it to the list. 1 Quote Link to post Share on other sites
itexspert 47 Posted November 24, 2014 Report Share Posted November 24, 2014 Can anyone update this http://www.amazon.com/gp/aw/d/B000M5NPKU/ref=mp_s_a_1_1?qid=1416838573&sr=8-1 how do i get ASIN number of of these links? Quote Link to post Share on other sites
CreativeWurks 9 Posted December 29, 2014 Report Share Posted December 29, 2014 Can anyone update this http://www.amazon.com/gp/aw/d/B000M5NPKU/ref=mp_s_a_1_1?qid=1416838573&sr=8-1 how do i get ASIN number of of these links?B\w+ seems to work in regex.. Im not sure what "flavor" ubot recognizes regex... Ive used the following in php coding and others: \/[A-Z][0-9]{10} Note... the \/ in the beginning of the expression is a backslash and forward slash, not the letter V.Ive tried the code in ubot 4 just a short bit ago and it will not accept the {10} variable. It keeps changing it to 10 and removing the symbols, also adding forward slashes. Perhaps you can buy the php plugin and run the regex in it, thus giving you the result you need. Im trying to build my own php plugin, so perhaps i can distribute that for free here on ubot. Ill try it in UBOT 5 and see if the regex works there. Quote Link to post Share on other sites
CreativeWurks 9 Posted December 30, 2014 Report Share Posted December 30, 2014 Resolved. Thanks TJ Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.