CSV Email Stripper Program

EmailStripper 0.1 screen compilation

Here’s a little open source Email Stripper freeware application that is essentially hacked together by yours truly in response to the mess that Hotmail exports. I needed a clear list of emails (for import in MailMan), cleaned for duplicates and without linebreaks and with a specific line deliminator; see screenshot for basic operation. The regexp detection is based on RFC 2822. Since I’m still Linux/OSX challenged this little app is Windows XP/Vista/7 only.

You can download the compiled exe from here:
EmailStripper.zip (version:2010-02-04 (0.1)) (thanks to Citif.dk for hosting) –note: AU3 compiled exe’s has history of being falsely detected as vira/malware,

And here is the source code (AU3 based), please post improvement in comments and I’ll update the post accordingly.

#cs ----------------------------------------------------------------------------
Script Name: email_stripper
Script Version: 2010-02-04 (beta)
Author: softhacker
Script Aspects:
    Strips emails from for an example csv outputs from hotmail or others
    RegExp taken from http://www.regular-expressions.info/email.html (RFC 2822)
#ce ----------------------------------------------------------------------------
#Include "Array.au3"
$pathtofile = FileOpenDialog("Please select file to strip from",@ScriptDir,"Pure txt files (*.txt;*.csv)",1)
$filehandle = FileOpen($pathtofile,0)
$text = FileRead($filehandle)
$text = StringLower($text)
$emailarray = StringRegExp($text, "[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", 4)
Dim $cleanedemailarray[UBound($emailarray)]
For $i = 0 To UBound($emailarray) - 1
    $match = $emailarray[$i]
    For $j = 0 to UBound($match) - 1
        $cleanedemailarray[$i] = $match[$j]
$cleanedemailarray = _ArrayUnique($cleanedemailarray)
$deliminator = InputBox ( "Please enter the delimiter needed between emails", "Enter deliminator(s) (; , | - )", ";")
$linebreakanswer = MsgBox(36,"Linebreaks or not","Do you want linebreaks after each entry?")
If $linebreakanswer = 6 Then $emailstring = _ArrayToString($cleanedemailarray,$deliminator & @CRLF)
If $linebreakanswer = 7 Then $emailstring = _ArrayToString($cleanedemailarray,$deliminator)
$filenametosaveto = FileSaveDialog("Please select file to save stripped material to",@ScriptDir,"Pure txt file (*.txt;*.csv)",16)
$filehandle = FileOpen($filenametosaveto,2)