i have a text like this ….
======== 1079.tif
Image Description : Vexcel-UCD-Level-3
------------------
CAM_ID: UCD-SU-1-0018 [5]
RECORD_GUID: 64763E99-3573-43AD-995B-8A07E3FE2BE3
IMG_NO: 1079
CAPTURE_TIME: 2004/03/15 02:07:17.641
IMG_TYPE: High resolution multi channel RGBI
ROTATION: 0 [degrees]
--- Inner Orientation ---------------
PRINCIPLE_DISTANCE: 101.400 [mm]
PRINCIPLE_POINT_X: 0.000 [mm]
PRINCIPLE_POINT_Y: 0.180 [mm]
PIXEL_SIZE_WIDTH: 9.000 [microns]
PIXEL_SIZE_HEIGTH: 9.000 [microns]
SENSOR_AREA_WIDTH: 103.500 [mm]
SENSOR_AREA_HEIGHT: 67.500 [mm]
-------------------------------------
--- Custom Meta Data ----------------
FMS No: 1079
Date: 070912
Time: 122005
Project: QOM
Area: QANAVAT
Line No: 11
Segment No: 1
Waypoint No: 17
WGS84 Latitude: N34.559857
WGS84 Longitude: E050.760726
WGS84 Altitude [m]: 1719.1
Pos Solution: GPS
Track [degree]: 271
Midpulse correction [s]: 0.00086
-------------------------------------
======== 1080vv.TIF
Image Description : Vexcel-UCD-Level-3
------------------
CAM_ID: UCD-SU-1-0018 [5]
RECORD_GUID: 64763E99-3573-43AD-995B-8A07E3FE2BE3
IMG_NO: 1080
CAPTURE_TIME: 2004/03/15 02:07:19.974
IMG_TYPE: High resolution multi channel RGBI
ROTATION: 0 [degrees]
--- Inner Orientation ---------------
PRINCIPLE_DISTANCE: 101.400 [mm]
PRINCIPLE_POINT_X: 0.000 [mm]
PRINCIPLE_POINT_Y: 0.180 [mm]
PIXEL_SIZE_WIDTH: 9.000 [microns]
PIXEL_SIZE_HEIGTH: 9.000 [microns]
SENSOR_AREA_WIDTH: 103.500 [mm]
SENSOR_AREA_HEIGHT: 67.500 [mm]
-------------------------------------
--- Custom Meta Data ----------------
FMS No: 1080
Date: 070912
Time: 122008
Project: QOM
Area: QANAVAT
Line No: 11
Segment No: 1
Waypoint No: 16
WGS84 Latitude: N34.559901
WGS84 Longitude: E050.758750
WGS84 Altitude [m]: 1717.9
Pos Solution: GPS
Track [degree]: 272
Midpulse correction [s]: 0.00086
-------------------------------------
as you can see it has a loop that repeats the information
i need to write a C# program to extract all these kind of substrings from my txt file
"1080"
"Longitude: E050.758750."
"Latitude : N34.559901."
[m]: 1717.9"
is there any one who can help me in this ????
thanks
Those “..” sections probably are CR,LF line endings that got lost in translation somewhere.
The obvious answer is to use Regular Expressions (RegEx), but you may want to pre-process a little by restoring the lines and extract stuff from certain lines only. I gather that it is a condition that your result groups are from 1 ‘line’. Especially that “1080” value could be mis-matched easily.
Post back when you need help with your regexes.
After Lasse’s fantastic Edit, the problem becomes a little clearer.
By looking at the data I would say you don’t really need RegEx, but you can process the data 1 line at a time and classify them with
line.StartsWith(...). When you find a line thatStartsWith("====")you have fond the end+start of a ‘record’.