retrieve email adresses from txt file





-7
Date Submitted Sat. Apr. 15th, 2006 12:47 AM
Revision 1 of 1
Syntax Master dannyboy
Tags "Email Address" | txt | VBSCRIPT
Comments 1 comments
Retrieve email adresses from a given text file

Dim fso,textstr,contents
Set fso = createobject("scripting.filesystemobject")
set textstr = fso.OpenTextFile( InputBox("textfile to search in?"), 1,False)
contents = textstr.ReadAll
WScript.echo retrieveEmails(contents)

Function retrieveEmails(input)
Dim regexp,matches,match,output
set regexp = New regexp
regexp.pattern="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
regexp.ignorecase=True
regexp.global=True
set matches= regexp.Execute(input)
For Each match In matches
        output & output & match.value & vbcrlf
Next
retrieveEmails = output
End Function
 

Comments

Comments fix
Thu. Aug. 3rd, 2006 9:14 PM    Beginner Devian

Voting