Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-28-2016, 12:19 AM
Mali Mali is offline
Registered User
 
Join Date: Oct 2016
Posts: 1
Reading Output and Filter it with Regular Expression

I try to filter the output of my command. I read it in into a variable and after that filter the output with the regular expression. But the regular expression does not work. I tried a lot of different ones....

This is the Output:

Product: C10G, System Uptime:145 d, 11 h, 27 m, 59 s
Chassis Serial No: N/A
System Time: Mon Sep 26 13:07:31 ICT 2016
128MHz, 5 PPM Crystal Clock

Module 6, Master SMM_2x10G, Status ACTIVE
Major rev 1, Minor rev 8
serial_no = SB15BCAS0032
CFE version 12.4.11
Uptime: 48 d, 5 h, 53 m, 3 s

Module 7, Slave SMM_2x10G, Status STANDBY
Major rev 1, Minor rev 8
serial_no = SB15BC7S0042
CFE version 12.4.11
Uptime: 45 d, 21 h, 9 m, 8 s

This is what I want to filter and write to my file:

"Uptime: **d" of Module 6 (red in the text above)

This is my current code:

Code:
Set file to write...
Set re1 = New RegExp
re1.Pattern = "Module 6,[\s+\S+]*(Uptime:s\d+)[\s+\S+]*Module 7,"

	strResult = crt.Screen.ReadString("Module 13")

	'Filter with Regular Expression
	Set matches = re1.Execute(strResult)
	
	For each match in matches
	match1 = match.submatches(0)
	next

	strSerial = match1		
	objFile.Write strSerial & ","
Capturing the Output does work, I have already testet it. And i dont get an error for setting the match1 = match.submatches(0). So it seems to be not "null"

What is wrong with my regular expression or the submatching?

Thank you
Reply With Quote
 

Tags
filtering , regular expression

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 06:55 PM.