Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Regular expression

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,63400
 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
  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 - 8/12/2008 8:17:49 PM   
  babraha

 

Posts: 1
Score: 0
Joined: 8/6/2008
Status: offline
Hi i am new to VB scripting i am currently trying to automate some tasks for a Configuration management tool called Synergy...my script starts as follows

Option Explicit
Dim strDate, iDay, iMonth, iYear, strDayMonth, strFilteredDate, strCmdLine, oSh, output, expected_addr,objExec
Const sCMD = "c:\windows\system32\cmd.exe /c "

'==============================  Main Body  ===============================
strCmdLine = sCMD & "ccm start -d \\vlgwap117caa\ccmdb\cmadmin -nogui -n babraha -pw xxxx -h slgwap117ca -home C:\Documents and Settings\babraha -u C:\temp"
'WScript.Echo strCmdLine
Set oSh = CreateObject("WScript.Shell")
Set objExec = oSh.Exec(strCmdLine)
output = objExec.StdOut.ReadAll



the output variable has  

Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

Starting Telelogic Synergy...
Removing obsolete file C:\Documents\_ccm_65.adr
Telelogic Synergy server starting on host slgwap117ca, using database \\vlgwap117caa\ccmdb\cmadmin

Telelogic Synergy Release 6.5.4096

© 1992 - 2007 Copyright Telelogic AB. All Rights Reserved.
This software is licensed and not sold. All use of this software is
subject to the terms and conditions of the Telelogic AB
End User Software License, which should be read carefully.
This program is protected by U.S. and international copyright laws as
described in the "About Telelogic Synergy" box.

RESTRICTED RIGHTS LEGEND/NOTICE

Use, duplication or disclosure by the government is subject to the
Restricted Rights restrictions as set forth in subparagraph (c)(1)(ii)
of the Rights in Technical Data and Computer Software clause at
DFARS 252.227-7013 or FAR 52.227-14, Alternate III,
subparagraph (g)(3)(i), each clause of current date.

Telelogic AB, Malmo, Sweden

Telelogic Synergy address is DLGW034241:3374:172.18.37.168



From the above output i would like to extract DLGW034241:3374:172.18.37.168 into a variable expected_addr.. can someone help me do it using regular expressions?

Thanks in Advance

< Message edited by babraha -- 8/12/2008 9:01:45 PM >
 
 
Post #: 1
 
 RE: Regular expression - 8/12/2008 11:45:03 PM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
I am not the best when it comes to regexp so I tend to try and find other ways to get what I want.  Someone should come along soon with an example but while we wait you could put Output into an array using vbcrlf to split it then using instr to find the correctline.

here is an example


      

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to babraha)
 
 
Post #: 2
 
 RE: Regular expression - 8/13/2008 12:48:41 AM   
  ehvbs

 

Posts: 2201
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi babraha,

use a RegExp:


      

output:

      


Good luck!

ehvbs

(in reply to mbouchard)
 
 
Post #: 3
 
 
 
  

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 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