Team_LX 3 Posted January 3, 2014 Report Share Posted January 3, 2014 Ok so i am trying to make a bot that will go into gmail and scrape a set regex for example i have been trying to figure out the regex for this for the longest time today ,"\u003cspan class\u003d\"yP\" email\u003d\"promotions@eprizepromotions.com\" name\u003d\"conagra@eprizepromotions.\"\u003econagra@eprizepromotions.\u003c/span\u003e","\u0026raquo;\u0026nbsp;","Your Snack Pack Code Request…","Here is your code to enter in the Snack Pack Instant Win and Sweepstakes: PD4P6YXP97WPRR76 Remember,",0,"","","9:10 am","Thu, Jan 2, 2014 at 9:10 AM",1388707668832000,, and i need to Get the 16 Digit code string after Sweepstakes but having issues finding the regex for it I know i am noob at the never messed with regex before Quote Link to post Share on other sites
UBotBuddy 331 Posted January 3, 2014 Report Share Posted January 3, 2014 Here ya go! ^.{1,}Sweepstakes: (.{1,16}).{1,} Now just use this code and you will see in action! set(#var, "\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"promotions@eprizepromotions.com\\\" name\\u003d\\\"conagra@eprizepromotions.\\\"\\u003econagra@eprizepromotions.\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"Your Snack Pack Code Request…\",\"Here is your code to enter in the Snack Pack Instant Win and Sweepstakes: PD4P6YXP97WPRR76 Remember,\",0,\"\",\"\",\"9:10 am\",\"Thu, Jan 2, 2014 at 9:10 AM\"", "Global") set(#var2, $replace regular expression(#var, "^.\{1,\}Sweepstakes: (.\{1,16\}).\{1,\}", "$1"), "Global") ui stat monitor("16 character code", #var2) Good Luck! Buddy Quote Link to post Share on other sites
Team_LX 3 Posted January 3, 2014 Author Report Share Posted January 3, 2014 (edited) didn't seem to work Here is them email via copy and paste idk if that make a diff i used page source to get the text in the op i am just needing the 16 digit text code after Sweepstakes conagra@eprizepromotions.com promotions@eprizepromotions.com via bounce.eprizemail.com 9:16 AM (9 hours ago) to me Here is your code to enter in the Snack Pack Instant Win and Sweepstakes: 4RJPRJ4WYR6HR7G9 Remember, you can also find codes inside specially marked Snack Pack packages. You can enter 1 code per day, so that means you can come back each day of the promotion for even more chances to win! Click Here to enter your code for a chance to win. Thank you and good luck! Snack Pack ©ConAgra Foods. All Rights Reserved. †MANY WILL ENTER, FEW WILL WIN. NO PURCHASE NECESSARY. A PURCHASE WILL NOT INCREASE YOUR CHANCES OF WINNING. LEGAL RESIDENTS OF THE 50 UNITED STATES (D.C.) AND PUERTO RICO 13 YEARS AND OLDER. VOID WHERE PROHIBITED. Promotion ends 4/30/14. For Official Rules, free method of entry, prize descriptions and odds disclosure, visit http://www.SnackPack.com/trip. Sponsor: ConAgra Foods, Inc. 215 W. Diehl Road, Naperville, IL 60563. © MARVEL. Shrek 4-D © 2014 DreamWorks Animation L.L.C. and Paramount Pictures Corporation. All Rights Reserved. Universal elements and all related indicia TM & © 2014 Universal Studios. All rights reserved. Edited January 3, 2014 by Team_LX Quote Link to post Share on other sites
UBotBuddy 331 Posted January 3, 2014 Report Share Posted January 3, 2014 Hmmm...not sure what you are seeing but it works for me. My proof for what its worth: http://screencast.com/t/G1DM4HL8B Good luck! Buddy Quote Link to post Share on other sites
UBotBuddy 331 Posted January 3, 2014 Report Share Posted January 3, 2014 I only used the code that you provided in your initial post. Let me check this whole email. Buddy Quote Link to post Share on other sites
Team_LX 3 Posted January 3, 2014 Author Report Share Posted January 3, 2014 I only used the code that you provided in your initial post. Let me check this whole email. Buddyyea was not sure if you needed the source or the email i am trying to get an over all regex code that works to get that 16 digit code Quote Link to post Share on other sites
UBotBuddy 331 Posted January 3, 2014 Report Share Posted January 3, 2014 You may have to load this email's content as sentences and then process each item with the regex code I gave you. For some reason my browser regex tool is not working. Buddy Quote Link to post Share on other sites
UBotBuddy 331 Posted January 3, 2014 Report Share Posted January 3, 2014 Okay. Try this set(#var, " conagra@eprizepromotions.com promotions@eprizepromotions.com via bounce.eprizemail.com 9:16 AM (9 hours ago) to me Here is your code to enter in the Snack Pack Instant Win and Sweepstakes: 4RJPRJ4WYR6HR7G9 Remember, you can also find codes inside specially marked Snack Pack packages. You can enter 1 code per day, so that means you can come back each day of the promotion for even more chances to win! Click Here to enter your code for a chance to win. Thank you and good luck! Snack Pack ©ConAgra Foods. All Rights Reserved. †MANY WILL ENTER, FEW WILL WIN. NO PURCHASE NECESSARY. A PURCHASE WILL NOT INCREASE YOUR CHANCES OF WINNING. LEGAL RESIDENTS OF THE 50 UNITED STATES (D.C.) AND PUERTO RICO 13 YEARS AND OLDER. VOID WHERE PROHIBITED. Promotion ends 4/30/14. For Official Rules, free method of entry, prize descriptions and odds disclosure, visit http://www.SnackPack.com/trip. Sponsor: ConAgra Foods, Inc. 215 W. Diehl Road, Naperville, IL 60563. © MARVEL. Shrek 4-D © 2014 DreamWorks Animation L.L.C. and Paramount Pictures Corporation. All Rights Reserved. Universal elements and all related indicia TM & © 2014 Universal Studios. All rights reserved. ", "Global") clear list(%list1) add list to list(%list1, $list from text(#var, " "), "Delete", "Global") set(#var2, $replace regular expression($list item(%list1, 3), "^.\{1,\}Sweepstakes: (.\{1,16\}).\{1,\}", "$1"), "Global") ui stat monitor("16 character code", #var2) set(#var, "", "Global") This still works for me. Of course you would need to tweak it for your bot. Buddy Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted January 3, 2014 Report Share Posted January 3, 2014 Try this for first example (?<=Sweepstakes: ).*?(?= Remember,) This for 2nd example (?<=Sweepstakes: ).* test it here http://regexhero.net/tester/ it may be better to get that line into a variable and replace everything except what you want on that line with nothing. something like this set(#code, $replace("Here is your code to enter in the Snack Pack Instant Win and Sweepstakes: 4RJPRJ4WYR6HR7G9", "Here is your code to enter in the Snack Pack Instant Win and Sweepstakes: ", $nothing), "Global") TC 1 Quote Link to post Share on other sites
UBotBuddy 331 Posted January 3, 2014 Report Share Posted January 3, 2014 Hey TC I love checking out other Regex websites. Looks interesting. I'll be testing more with this one.Buddy Quote Link to post Share on other sites
wizeone17 7 Posted January 14, 2014 Report Share Posted January 14, 2014 Anyone know of any good free regex training websites. This stuff has me scratching my head. 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.