| |
asnadig
Posts: 12
Score: 0
Joined: 4/1/2008
Status: offline
|
Set objRegEx = CreateObject("VBScript.RegExp") objRegEx.Global = True objRegEx.IgnoreCase = True objRegEx.Pattern = "<LzExecutionId>E243751</LzExecutionId>" Set fsoxlsFile = CreateObject("Scripting.FileSystemObject") sFileName = "C:TradeLogs\LZDealingTrade.log" Set fxlsFile = fsoxlsFile.OpenTextFile(sFileName,1,True) sSrchStr = fxlsFile.ReadAll Set Matches = objRegEx.Execute(sSrchStr) For Each mymatch In Matches sTime = Mid(sSrchStr,(mymatch.FirstIndex-182), 20) sID = Mid(sSrchStr,(mymatch.FirstIndex+16), 7) MsgBox sID&":"&sTime, 0, "Trade ID And Time" Next Set objRegEx = Nothing Set fsoxlsFile = Nothing *********************************************************** In the above code, the pattern (objRegEx.Pattern = "<LzExecutionId>E243751</LzExecutionId>") The colored ID(i.e.243751) will change. It could be any number. How can I make this to read any number. I tried objRegEx.Pattern = "<LzExecutionId>E[0-9]</LzExecutionId>"). This is not working. Could some one give me the correct pattern which should capture any ID?
|
|