devpro 4 Posted December 9, 2013 Report Share Posted December 9, 2013 Hi guys I have a question about a list from file. When i load my csv into a list and assign it to a list For example i have user1@hotmail.comuser2@hotmail.comuser3@hotmail.comuser4@hotmail.com I want than to manipulate this list and only have this left in it user1user2user3user4 I know how to create a regex expression for this. I know how to manipulate a list and put it in a variable but than i have one long variable with one name. How do you either create a new list or update the list that is loaded from a file. Thank you for the help Quote Link to post Share on other sites
the_way 52 Posted December 9, 2013 Report Share Posted December 9, 2013 you would add the first item of the list (user1@hotmail.com) into a variable, #replace_email then you do the regex on that variable to remove everything after the @ then you add the new (user1) variable into a new list then remove from the original list (user1@hotmail.com) stick the above in a loop while (original list total > 0 ) done Quote Link to post Share on other sites
devpro 4 Posted December 9, 2013 Author Report Share Posted December 9, 2013 Thank you very much This worked perfect. define List_manipulation { add list to list(%accounts, $list from file(#file_open), "Don\'t Delete", "Global") loop while(%accounts > 0) { set(#replace_email, $replace regular expression($list item(%accounts, 0), "@hotmail.com.*", $nothing), "Global") add item to list(%accounts_processed, #replace_email, "Delete", "Global") remove from list(%accounts, 0) } 1 Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted December 9, 2013 Report Share Posted December 9, 2013 Here is another angle of attack... set(#replace, $replace($read file("{$special folder("Desktop")}\\replace test.txt"), "@hotmail.com", $nothing), "Global")add list to list(%replaced, $list from text(#replace, $new line), "Delete", "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.