Thread email adressen aus text filtern? (13 answers)
Opened by Gast at 2007-05-22 00:23

bloonix
 2007-05-23 12:40
#76827 #76827
User since
2005-12-17
1615 Artikel
HausmeisterIn
[Homepage]
user image
[quote=pq,22.05.2007, 20:36]hmm, aber das kann keine email-adressen *finden*, so wie
CPAN:Email::Find, oder?[/quote]
Korrekt. CPAN:Mail::RFC822::Address stellt selber keine Möglichkeit zur
Verfügung, um Emails in einem Text zu finden. Das geht nur, wenn man
selber sucht.

Code: (dl )
1
2
3
4
5
6
my $rfc822re = &Mail::RFC822::Address::make_rfc822re;

while (my $line = <DATA>) {
  print "Valid mail: ".$_."\n"
     for $line =~ /($rfc822re)/g;
}


Hinzu kommt, dass man - wie Nepos schon schrieb - nur validieren kann.
Mail::RFC822::Address kann nicht formatieren wie zum Beispiel
<foo  @  test.example> nach foo@text.example.

So gesehen wäre Email::Find dann die bessere Alternative.\n\n

<!--EDIT|opi|1179909758-->
What is a good module? That's hard to say.
What is good code? That's also hard to say.
One man's Thing of Beauty is another's man's Evil Hack.

View full thread email adressen aus text filtern?