Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Regular Expression Pattern- Assistance

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,61635
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Regular Expression Pattern- Assistance
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Regular Expression Pattern- Assistance - 6/19/2008 8:04:24 AM   
  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?
 
 
Post #: 1
 
 RE: Regular Expression Pattern- Assistance - 6/19/2008 8:33:32 AM   
  dm_4ever


Posts: 2665
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline

      

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to asnadig)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Regular Expression Pattern- Assistance Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts