I have a list here with some email addresses that need to be "cleaned" The list is in a text file, and looks like this * the list does have more email addresses, and this is only an example. Now I need some PHP code to ONLY show all the email addresses from domain1.com (and if needed only from domain2.com or domain3.com ect...) Someone here who can show me how this is done? (I guess it needs to make use of a wild card for the pre @ part) Thank you
Code: <?php # [email protected] # $file = "path_to_file"; $domain = "domain1.com"; if(file_exists($file)){ $x = fopen($file,"r"); if($x){ while(!feof($x)){ $b = fgets($x, 4096); if (eregi($domain, $b)) print "$b\n"; } fclose($x); } }else{ print "File $file does not exist"; } ?>