Link to home
Start Free TrialLog in
Avatar of lancerxe
lancerxe

asked on

splitting files

Hello experts:

I asked this question on 3-16-2010
"I have a file that needs to be procesed in a C# application
but the records are all in one big record
soI need to split them before I process it.
I tried SPLIT and REGEX but it's not working.

File is attached.
Each individual record starts with  these characters:   {1100}
thanks

the solution was:                      

string[] lines = Regex.Split(value, @"\{1100\}");

and it worked

now i have a related question

I have another file but this one starts with these characters:YFT811
File is attached

so I tried to split like this:
 string[] lines = Regex.Split(value, @"\{YFT811\}");

but it does not work. I only get the 1st record and then it ignores
the rest.


FundsOutgoingMessages---Copy.txt
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In the original solution each record started with {100} but in this case each record starts with YFT811 note no { or } so you needed to remove them from the regex pattern. You need to verify that this pattern, YFT811, can only occur at the beginning of the record and no place else it will split it incorrectly.