socialcracker 59 Posted November 12, 2012 Report Share Posted November 12, 2012 Hello People,I am a newbie with ubot and regex.I am trying to grab username from emails.. Here is the email in table Column 4: your username is: Banana123 visit this link to verify your email address: http://example.com/verify/qw123t thanks for using our website! Below is my code:-connect to mail server("POP3", "mail@example.org", "pass123", "mail.example.org", 110) { create table from emails(&allemails) } add list to list(%username, $find regular expression(&allemails, "(?<=your\\susername\\sis:\\n\\n\\s\\s\\s\\s).*?(?=\\n\\nvisit\\sthis\\slink\\sto\\sverify\\syour\\semail\\saddress)"), "Delete", "Global") Regular expression code: (?<=your\susername\sis:\n\n\s\s\s\s).*?(?=\n\nvisit\sthis\slink\sto\sverify\syour\semail\saddress:) Whenever i run the script, i see nothing in %username list..I am trying to grab "Banana123" in the list. Please help me out.. Quote Link to post Share on other sites
VaultBoss 310 Posted November 12, 2012 Report Share Posted November 12, 2012 Try this: set(#email, "Banana123@gmail.com", "Global") set(#nick, $replace regular expression(#email, "(@.*)", $nothing), "Global") ^^^ That is just an example (you'll need to loop through your list of emails and replace one by one) 2 Quote Link to post Share on other sites
socialcracker 59 Posted November 13, 2012 Author Report Share Posted November 13, 2012 Try this: set(#email, "Banana123@gmail.com", "Global") set(#nick, $replace regular expression(#email, "(@.*)", $nothing), "Global") ^^^ That is just an example (you'll need to loop through your list of emails and replace one by one)Hello,Thanks for the code..However,I am not looking to grab the word before @example.comI am looking to grab the word "Banana123" from the table cells. your username is: Banana123 visit this link to verify your email address: The username is auto-generated from site and gets different from email.. However, you gave me an idea for another bot.. My problem is still not solved.. looking for a solution.. Quote Link to post Share on other sites
pftg4 102 Posted November 13, 2012 Report Share Posted November 13, 2012 two nodes no regex needed add list to list(%test, $list from text("your username is: Banana123 visit this link to verify your email address: http://example.com/verify/qw123t thanks for using our website! ", $new line), "Delete", "Global") set(#email, $list item(%test, 1), "Global") i of course pasted text in you will have a table cell in there pftg4 2 Quote Link to post Share on other sites
socialcracker 59 Posted November 13, 2012 Author Report Share Posted November 13, 2012 two nodes no regex needed add list to list(%test, $list from text("your username is: Banana123 visit this link to verify your email address: http://example.com/verify/qw123t thanks for using our website! ", $new line), "Delete", "Global") set(#email, $list item(%test, 1), "Global") i of course pasted text in you will have a table cell in there pftg4That is awesome !Solved my problem Thanks a lot.. Quote Link to post Share on other sites
gabel 51 Posted November 14, 2012 Report Share Posted November 14, 2012 try this regex (?<=username\ is:)[\w\W]*?(?=visit\ this) 1 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.