<?php error_reporting(0); function email_parser($str) { $str = strtolower($str); $pattern = '`[a-z0-9][-_\.a-z0-9]+[a-z0-9]@[-\.a-z0-9]+[a-z]`'; preg_match_all($pattern, $str, $matches); $out = $matches[0]; $out = array_unique($out); sort($out); return $out; } ?> <form action="" method="post"> <textarea cols="40" rows="7" style="width:98%" name="in"><?php echo $_POST['in'] ?></textarea> </form> <?php if(count($_POST)) : ?> <?php $emails = email_parser($_POST['in']) ?> <hr /> <?php echo count($emails) ?> adresses <?php echo implode("\n", $emails) ?> <?php endif ?>
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questiontoto = "bla bla bla lui@yahoo.fr aaaa K@A.fr blabla" titi = Split(toto, " ") For i = O To UBound(titi) If titi(i) Like "*@*.*" Then trouve = titi(i) MsgBox titi(i) & " est peut-être une adresse email ?" End If Next