Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

I have this log on my txt file:

 

line 1) M7994959481766084OP-M-SAC53320050405182339Last Bag >> Break 20

line 2) 05

line 3) M7994959481788092FL-M-SAC20320050405182119Active Flight Schedule

line 4)

line 5) W7994959481788093BA-W-OCC00220050405182119SortingID >> 0304200

line 6) 5 Chute/LineNo= FS2-G

 

How do i combine line 1 & 2, line 3 & 4, line 5 & 6. The other things is I try using this regex

regex r = new Regex (19|20)[90][0-9](0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01]) and try to seperate between ;

 

example: Column 1

M7994959481766084OP-M-SAC533

 

Column 2

200504051823 ----- date format yyyymmddhhmm

 

Column 3

Last Bag >> Break 20

 

into each column using dataset but i still got this

 

Column 1

M7994959481766084OP-M-SAC533

 

Column 2

200504051823Last Bag >>Break 20

 

which is i can't seperate the date format at column 2. Please help me. :)

Edited by syeerol
  • 2 months later...
Posted

A while since you posted but oh well...

 

I would use:

 

((19|20)[90][0-9](0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01])[0-9]{4})[0-9]{2}

 

i.e. extended your regex slightly then use the spit function. The splits you want will be the first, second and last.

 

:)

Please check the Knowledge Base before you post.

"Computers are useless. They can only give you answers." - Pablo Picasso

The Code Net

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...