Schrift
[thread]9023[/thread]

email adressen aus text filtern? (Seite 2)

Leser: 2


<< |< 1 2 >| >> 14 Einträge, 2 Seiten
pq
 2007-05-22 22:36
#76824 #76824
User since
2003-08-04
12209 Artikel
Admin1
[Homepage]
user image
[quote=opi,22.05.2007, 13:50]CPAN:Mail::RFC822::Address kann ich nur empfehlen.[/quote]
hmm, aber das kann keine email-adressen *finden*, so wie
CPAN:Email::Find, oder?
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem
Ronnie
 2007-05-22 23:02
#76825 #76825
User since
2003-08-14
2022 Artikel
BenutzerIn
[default_avatar]
nepos
 2007-05-23 10:06
#76826 #76826
User since
2005-08-17
1420 Artikel
BenutzerIn
[Homepage] [default_avatar]
CPAN:Mail::RFC822::Address ist nur zum Pruefen, ob eine Email-Adresse eine gueltige Form hat.
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.
<< |< 1 2 >| >> 14 Einträge, 2 Seiten



View all threads created 2007-05-22 00:23.