Bonjour,
je rajoute un test pour les e-mails avec un petit raffinement pour le tri, la possibilité de faire le tri classique ou par domaine+nom
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 function ExprMail(const S : String; var V : String; tripardomaine : Boolean = False): TSortTypeInterne; var Expr : TRegEx; Match : TMatch; const Expression = '(?<Nom>[a-zA-Z0-9_\-\.]+)@'+ '(?<Domaine>((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|'+ '(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3}))'; begin Expr:=TRegEx.Create(Expression,[roExplicitCapture]); Match:=Expr.Match(S); if Match.Success then begin if triparDomaine then V:=Match.Groups['Domaine'].Value+Match.Groups['Nom'].Value else V:=S; result:=stiEmail; end else begin V:=S; result:=stiText; end; end;
Partager