Records only for easy reuse. Type handling for the following formats
“
AAAA [email protected] Sfsfs
AFALFJAF [email protected] AFAF AFA
”
One line of email has a distinct segmentation symbol. A line of more than one email to change it.
Program Project1; {$APPTYPE CONSOLE} {$R *.res}uses system.sysutils, windows, perlregex;var txt,savetxt:textfile; str:string; Reg:tperlregex; I:int64;begin try reg: = tperlregex.create; AssignFile (TXT, ' xxx.com.sql '); AssignFile (savetxt, ' saved.txt '); Reset (TXT); Rewrite (savetxt); Reg. RegEx: = ' ([A-za-z0-9-_.+%][email protected][a-za-z0-9-.] +\. [A-za-z] {2,4}) '; i:=0; While not Eof (TXT) does begin Readln (TXT,STR); Reg. Subject: = str; If Reg. Match then begin Writeln (Savetxt,reg. Groups[1]); End; INC (i); Write (#13); Write (IntToStr (i)); End; CloseFile (TXT); CloseFile (savetxt); Reg. Free; READLN; Except on e:exception do writeln (e.classname, ': ', e.message); End;end.
Delphi extracts the email data from txt