sjarad 0 Posted April 9, 2013 Report Share Posted April 9, 2013 Hello, I'm trying to scrap only the "3006" to a text file. And it could change to more than 4 digits. Possibly 5 digits such as "355356". And If possible, The Item ID should not be case sensitive. Please help. Thank you!! <br> <b id=\"yui_3_7_2_1_1365476531574_1800\">Se habla espanol!</b>Brand New White Wood BunkBed Rounded Ends and Stackable!<br>Please note: the above is not the actual price.It is for posting purposes only.<br>ITEM ID:3006<br><br><img border=\"0\" alt=\" photo Coupon50off_zpsa7b32ab320.jpg\" width=\"400\" height=\"400\" id=\"yui_3_7_2_1_1365476531574_1810\"> Quote Link to post Share on other sites
utsavat 1 Posted April 9, 2013 Report Share Posted April 9, 2013 (edited) Use Regular Expression set(#Email Content, "Hello, I\'m trying to scrap only the \"3006\" to a text file. And it could change to more than 4 digits. Possibly 5 digits such as \"355356\". And If possible, The Item ID should not be case sensitive. Please help. Thank you!! <br> <b id=\\\"yui_3_7_2_1_1365476531574_1800\\\">Se habla espanol!</b> Brand New White Wood BunkBed Rounded Ends and Stackable! <br> Please note: the above is not the actual price.It is for posting purposes only. <br> ITEM ID:3006 <br> <br> <img border=\\\"0\\\" alt=\\\" photo Coupon50off_zpsa7b32ab320.jpg\\\" width=\\\"400\\\" height=\\\"400\\\" id=\\\"yui_3_7_2_1_1365476531574_1810\\\"> ", "Global") set(#item id, $find regular expression(#Email Content, "ITEM ID:.\{1,\}\\d"), "Global") set(#item id, $replace(#item id, "ITEM ID:", $nothing), "Global") This Works Perfect, Edited April 9, 2013 by utsavat Quote Link to post Share on other sites
sjarad 0 Posted April 9, 2013 Author Report Share Posted April 9, 2013 Hi,That didn't work It's case sensitive with "Item Id" and it grabs everything after the "3006". Any other ideas?? Thanks Quote Link to post Share on other sites
webpro 31 Posted April 10, 2013 Report Share Posted April 10, 2013 Try this [0-9]+ I just added this code at the end of my regex and it selects any numbers (any lenght) http://www.mysite.com/profiles/[0-9]+ Quote Link to post Share on other sites
sjarad 0 Posted April 10, 2013 Author Report Share Posted April 10, 2013 That grabbed all the numbers in that email. I only need the numbers after the Item ID. Example output should be: 3006 Please advise. Quote Link to post Share on other sites
Anonym 53 Posted April 18, 2013 Report Share Posted April 18, 2013 Since I haven't had access to your email, I had to put the assumed HTML into a variable, but the regexp for fidning your ID could look like this:(the REAL HTML compared to the assumed HTML might differ in terms of new lines/line breaks etc) set(#htmlFromPage, "<br> <b id=\\\"yui_3_7_2_1_1365476531574_1800\\\">Se habla espanol!</b> Brand New White Wood BunkBed Rounded Ends and Stackable! <br> Please note: the above is not the actual price.It is for posting purposes only. <br> ITEM ID:3006 <br> <br> <img border=\\\"0\\\" alt=\\\" photo Coupon50off_zpsa7b32ab320.jpg\\\" width=\\\"400\\\" height=\\\"400\\\" id=\\\"yui_3_7_2_1_1365476531574_1810\\\">", "Global") set(#id, $find regular expression(#htmlFromPage, "(?<=<br>\\nITEM ID:)[0-9]+(?=\\n<br>\\n<br>\\n<img\\sborder=)"), "Global") Quote Link to post Share on other sites
UBotDev 276 Posted April 27, 2013 Report Share Posted April 27, 2013 Just use this regex: (?<=ITEM\s*ID:\s*)\d+ It works with the HTML you provided: set(#ID, $find regular expression("<br> <b id=\\\"yui_3_7_2_1_1365476531574_1800\\\">Se habla espanol!</b> Brand New White Wood BunkBed Rounded Ends and Stackable! <br> Please note: the above is not the actual price.It is for posting purposes only. <br> ITEM ID:3006 <br> <br> <img border=\\\"0\\\" alt=\\\" photo Coupon50off_zpsa7b32ab320.jpg\\\" width=\\\"400\\\" height=\\\"400\\\" id=\\\"yui_3_7_2_1_1365476531574_1810\\\"> ", "(?<=ITEM\\s*ID:\\s*)\\d+"), "Global") 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.