E
Eric
I use RegEx to search pattern. Script works fine in the situation when
there is a colon after each word and it fetch the rest of the word from
that line. Now the pattern is in square bracket and i need help how to
change that line (sPattern =
"From\:\s*([\s\S]+?)[\r\n]+") so that it search pattern in a square
bracket and fetch the next line of that pattern.
Dim fso, fil, ts, sContents
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fil = fso.getfile(server.mappath("myemails.txt"))
Set ts = fil.openastextstream(1)
sContents = ts.readall
sPattern = "From\:\s*([\s\S]+?)[\r\n]+"
Dim rx
Set rx = New RegExp
rx.Global = True
rx.IgnoreCase = True
rx.MultiLine = True
rx.Pattern = sPattern
Set mc = rx.Execute(sContents)
Set rm = mc.Item(0)
sFrom = rm.SubMatches(0)
response.write(sFrom)
ts.close
Set rx = nothing
Set ts = nothing
Set fil = nothing
Set fso = nothing
-----SAMPLE DATA--------
[Date]
Sat Aug 05 14:06:12 EDT 2006
[Novell ID]
NSMITH4
[Subject]
PPV / VOD Research - Dispute - 1st Time - 711579
[Customer's Name]
EDWARD CAMPBELL
there is a colon after each word and it fetch the rest of the word from
that line. Now the pattern is in square bracket and i need help how to
change that line (sPattern =
"From\:\s*([\s\S]+?)[\r\n]+") so that it search pattern in a square
bracket and fetch the next line of that pattern.
Dim fso, fil, ts, sContents
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fil = fso.getfile(server.mappath("myemails.txt"))
Set ts = fil.openastextstream(1)
sContents = ts.readall
sPattern = "From\:\s*([\s\S]+?)[\r\n]+"
Dim rx
Set rx = New RegExp
rx.Global = True
rx.IgnoreCase = True
rx.MultiLine = True
rx.Pattern = sPattern
Set mc = rx.Execute(sContents)
Set rm = mc.Item(0)
sFrom = rm.SubMatches(0)
response.write(sFrom)
ts.close
Set rx = nothing
Set ts = nothing
Set fil = nothing
Set fso = nothing
-----SAMPLE DATA--------
[Date]
Sat Aug 05 14:06:12 EDT 2006
[Novell ID]
NSMITH4
[Subject]
PPV / VOD Research - Dispute - 1st Time - 711579
[Customer's Name]
EDWARD CAMPBELL