Advertisement
Guest User

Untitled

a guest
Jun 15th, 2015
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. open (MYFILE, 'data.txt');
  2. while (<MYFILE>) {
  3. chomp;
  4. my @words = split(' ');
  5. foreach my $word (@words) {
  6. if($word =~ /.+@.+..{2,6}/) {
  7. print "$_n";
  8. }
  9. }
  10. }
  11.  
  12. use Email::Valid;
  13. open (MYFILE, 'data.txt');
  14. while (<MYFILE>) {
  15. chomp;
  16. my @words = split(' ');
  17. foreach my $word (@words) {
  18. if(Email::Valid->address($word)) {
  19. print "$wordn";
  20. }
  21. }
  22. }
  23.  
  24. print "$_n";
  25.  
  26. print "$wordn";
  27.  
  28. open (MYFILE, 'data.txt');
  29. while (<MYFILE>) {
  30. chomp;
  31. my @words = split(' ');
  32. foreach my $word (@words) {
  33. if($word =~ /^[^@]+@+[^.]+.+[^.]{2,6}$/) {
  34. print "$wordn";
  35. }
  36. }
  37. }
  38.  
  39. me@me.com mine@mine.co.uk myself@email.net
  40. me@me.com mine@mine.in myself@email.ru
  41. me@me.com mine@mine.co.uk myself@email.america
  42.  
  43. Output
  44. ------
  45. me@me.com
  46. myself@email.net
  47. me@me.com
  48. mine@mine.in
  49. myself@email.ru
  50. me@me.com
  51.  
  52. /bw+(.?[*+-=^$#!~?w])*@w+(.?[*+-=^$#!~?w])*w+b/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement