Here is the general idea of what I am trying to do. I am working on a healthcare application that receives a text file in the HL7 format. HL7 uses a very odd file format that utilizes the * character for column separators and the ~ as the line terminator. So, for example, the first line could be:
ISA*00* *00* *ZZ*100000 *ZZ*71160~
The next line might be:
GS*HB*77027*71160*20061211*10341367*4*X*004010X092 A1~
Each element separated by a * character has a different meaning based on the beginning of the line (for example ISA vs. GS). The beginning of the line may vary slightly, such as GS*HB or GS*H1. So it owuld be advantageous to be able to match each line that starts with GS and ends with~. Some GS lines my have 5 elements, others may have 7, others may have 9. So identifying each type of line is needed to parse the file properly (couldn't they just use XML :)). But I can't figure out exactly how to do this.
Any insight is greatly appreciated. Thanks.
|