Hope someone can help me. I’m using VB.net to scan a log file that gets written to every few seconds. I’m using a timer and capturing the appended information since the last scan(every 10 seconds). I’m then trying to identify the following text patterns and capture the bolded information in an array which will then be exported to an XML file. There will be many lines of unwanted data prior to and after the relevant data.
The data will be structured in the same format for the foreseeable future so I don’t really need the field identifiers but if they need to be in an array so be it. One problem I have is that the text/log file can accept 2 structures of people and vehicles. EX 1 & 2 is for the people and 3 &4 is for the vehicles. Both frameworks seem to have similar construction but one has carriage returns and one is pretty much a single line.
I was going to use instr and mid functions to parse this data line by line in a loop but stumbled on to regex and thought it might be quicker than checking every line. The time spent trying to learn and create a complicated pattern is seeming less likely but maybe somebody can help with expertise in this?
EXAMPLE 1:
10/8/2008 13:49:43 = MESSAGIN = STAT --> RF_MSG_DATA_AVAILABLE
10/8/2008 13:49:43 = MESSAGIN = USER --> MESSAGING state:276
10/8/2008 13:49:43 = MESSAGIN = RECV -->
DF/JOHN/B/VAN DOE/M/010189 09/15/08 07.50AM CT
> > > > > > > >THIS RECORD DISPLAYS AN ID-CARD< < < < < < < <
DID/X000-0000-0000-00
NAM/VAN DOE, JOHN B
STR/1234 MAIN ST
STR/1234 MAIN STCTY/MYTOWN ST/WI ZIP/54901 CT/GRANT SEX/M RAC/WHITE DOB/010189 HGT/502 WGT/115 HAI/BLND EYE/BLUE DONR/ Y
LT= RGLR ISS= 08/19/2001 EXP= 02/12/2009 AT= RNW
CLASSES= D
STATUS= VAL
PRDT#= 36150-973-102
---------------------------------------------------------------------
LT= REGI INSTRPMT ISS= 06/13/1995 EXP= 12/13/1995 AT= ORG
CLASSES= D
STATUS= EXP
PRDT#= 12240-951-640
=====================================================================
( PAGE 1 - END )
Example 2:
10/8/2008 13:49:43 = MESSAGIN = STAT --> RF_MSG_DATA_AVAILABLE
10/8/2008 13:49:43 = MESSAGIN = USER --> MESSAGING state:276
10/8/2008 13:49:43 = MESSAGIN = RECV --> MFR_1275541_*Con;W4_MP.E64MS_10/08/08 13:50:01_0_nOQ 12:38:41_nOQ 12:38:41 /0781 1809 F222 WI0710005 DOT 171236 130 10/08/08 12:39 01 OF 01 DF/JOHN/B/VAN DOE/F/010660 10/08/08 12.39PM CT DID/ X000-0000-0000-00NAM/ VAN DOE, JOHN B STR/1234 MAIN ST CTY/ ANYTOWN ST/ WI ZIP/54901 CT/WINNEBAGO SEX/F RAC/WHITE DOB/010660 HGT/504 WGT/105 HAI/BLND EYE/BLUE DONR/ Y LT= RGLR ISS= 12/26/2003 EXP= 01/06/2012 AT= RNW CLASSES= D STATUS= VAL REST= GLS PRDT#= 40364-920-072 ===================================================================== 051987 FORMER/ X000-0000-0000-00NAM/WALKER, JOHN B 080603 091803 CONVICT SI 04 CT/WAUPACA OPR AS=D ( PAGE 1 - END )
EXAMPLE 3:
10/8/2008 13:49:31 = SCAEXT2 = STAT --> RF_MSG_SIGNAL_LEVEL:92
10/8/2008 13:49:31 = SCAEXT2 = USER --> SCAEXT2 state:276
10/8/2008 13:49:33 = MESSAGIN = STAT --> RF_MSG_DATA_AVAILABLE
10/8/2008 13:49:33 = MESSAGIN = USER --> MESSAGING state:276
10/8/2008 13:49:33 = MESSAGIN = RECV --> MFR_1275540_*Con;W4_MP.E64MS_10/08/08 13:49:46_0_QOQ 13:48:43_QOQ 13:48:43 /0173 1809 F611 WI0710005 DOT 193240 133 10/08/08 13:49 01 OF 01 INP Input Request: INP1 Plate: 123ABC Type: AUT 10/08/2008 01.49 PM CT INP2 Response 1 of 1 PLT Plate Information: PLT1 NBR: 123ABC / Type: AUT - AUTOMOBILE REG Registration Information: REG1 Type: AUTO / Last Updated: 10/18/2007 at 04:00 PM REG2 Status: EXPIRED REG3 Period: ANNUAL / Expires: 10/31/2003 OWN Owner Detail: OWN1 1st: VAN DOE JOHN B OWN2 DOB: 01/26/1975 / DID: X0000000000000 OWN1 AND: VAN DOE JANE R OWN2 DOB: 08/26/1977 / DID: X0000000000000 OWN3a 1255 VAN HORN ST OWN3d BERLIN WI 54923 VEH Vehicle Information: VEH2 12345678912345678 / TRUCK VEH3 Year: 2002 / Make: FORD VEH4 Model: F150 SUPERCREW / Style: PICKUP___0_
EXAMPLE 4:
09/15/2008 10:24:24 = GPS = USER --> Sending data to SCASocket: >RPV55513+2220370-0774478400807412<
09/15/2008 10:24:26 = STATE = STAT --> RF_MSG_DATA_AVAILABLE
09/15/2008 10:24:26 = STATE = USER --> STATE state:276
09/15/2008 10:24:26 = STATE = RECV --> SFR_3006412_FORM=TEXT_SUM=DOT _TEXT=Transaction number: 125190
INP Input Request:
INP1 Plate: AB1234 Type: TRK 09/15/2008 10.25 AM CT
INP2 Response 1 of 1
PLT Plate Information:
PLT1 NBR: AB1234 / Type: LTK - LIGHT TRUCK
REG Registration Information:
REG1 Type: LIGHT TRUCK / Last Updated: 07/07/2008 at 12:00 PM
REG3 Period: ANNUAL / Expires: 08/31/2009
REG4 Carrier: none / VEH GRS WT: 6000LB
OWN Owner Detail:
OWN1 1st: VAN DOE JOHN B
OWN2 DOB: 01/26/1955 / DID: S1234567891234
OWN3a 1234 MAIN ST
OWN3d MILWAUKEE WI 53201
VEH Vehicle Information:
VEH2 12345678912345678 / TRUCK
VEH3 Year: 2002 / Make: FORD
VEH4 Model: F150 SUPERCREW / Style: PICKUP
TTL Title Information:
TTL1 Title Number: 1234567891234
__0_0_
09/15/2008 10:24:26 = USERREGI = USER --> ALARM - Service: STATE State:True AlarmFile:Blank.wav
09/