#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 & "," What is wrong with my regular expression or the submatching? Thank you |
Tags |
filtering , regular expression |
Thread Tools | |
Display Modes | Rate This Thread |
|
|