andieje
asked on
Help needed with regular expression
Hi
I would appreciate some help/feedback/improvements on some regular expression stuff i am doing. Here is the string i need to parse. It's hopefully quite easy
3480:#ID,357262002205552,I OP,O,0x00, I,0x00,GPS EX,A,D,170 708,T,1459 37,La,51.5 2225,N,Lo, 0.11623,E, V,0.5
This consists of
1. 4 digit number followed by :#ID,
2. 15 digit number which i need to extract following by the constant text ,IOP,O,0X00,
3. The letter I followed by either 0x00 or 0x10. I need to extract the 0x00/0x10
4. GPSEX followed by an A or V. I need to extract the A/V
5. D followed by the date. I need to obtain the date
6. T followed by the time. I need to obtain the time
7. La followed by some numbers then then initial N. I need to extract the numbers
8. Lo followed by some numbers then then initial E. I need to extract the numbers
9 V followed by some numbers. I need to extract the numbers.
Here is my reg ex/basic code
Dim gpsRegEx As String = "^\d{4}:#ID,(\d{15}),IOP,O ,0x00,I,([ 0x00|0x10] ),GPSEX,([ A|V]),D,(\ d{6}),T,(\ d{6}),La,( *{6,7}),N, Lo,(*{6,7} ),E,V,(*{3 ,4})
Dim m As Match
Dim r As Regex = New Regex(gpsRegEx)
m = r.Match(data)
As said earlier, any feedback or improvements much welcomed
thanks
andrea
I would appreciate some help/feedback/improvements
3480:#ID,357262002205552,I
This consists of
1. 4 digit number followed by :#ID,
2. 15 digit number which i need to extract following by the constant text ,IOP,O,0X00,
3. The letter I followed by either 0x00 or 0x10. I need to extract the 0x00/0x10
4. GPSEX followed by an A or V. I need to extract the A/V
5. D followed by the date. I need to obtain the date
6. T followed by the time. I need to obtain the time
7. La followed by some numbers then then initial N. I need to extract the numbers
8. Lo followed by some numbers then then initial E. I need to extract the numbers
9 V followed by some numbers. I need to extract the numbers.
Here is my reg ex/basic code
Dim gpsRegEx As String = "^\d{4}:#ID,(\d{15}),IOP,O
Dim m As Match
Dim r As Regex = New Regex(gpsRegEx)
m = r.Match(data)
As said earlier, any feedback or improvements much welcomed
thanks
andrea
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
wonderful as ever fernando
Glad I was able to help. ;=)
Open in new window