This is where regular expressions really shine.
/ISA(.).{2}\1.{10}\1.{2}/
which says "look for the upper case letters ISA followed by a single character
(remember it), followed by 2 characters, your remembered character, 10
characters, that pesky character again, followed by 2 more ... and on if
necessary. If you wrote out the definition of the entire segment, you would
have a piece of code that would recognise any X12 interchange regardless of
choice of element delimiter and segment terminator, and return those two to you
as a side effect.
Howard
1 Peter 4:10
----- Original Message ----
From: Mike Rawlins <[email protected]>
To: [email protected]
Sent: Wed, July 21, 2010 1:00:17 PM
Subject: Re: [EDI-L] <TECH>ISA recognition
Chris,
That is very similar to the approach I took with an open source X12
parser/translator project. Without looking at the code I think I might
have checked beyond the 7th position for additional element separators,
but that level of thoroughness would probably screen out an extremely
small number of cases in actual practice.
Mike
------------------------------------
...
Please use the following Message Identifiers as your subject prefix: <SALES>,
<JOBS>, <LIST>, <TECH>, <MISC>, <EVENT>, <OFF-TOPIC>
Job postings are welcome, but for job postings or requests for work: <JOBS> IS
REQUIRED in the subject line as a prefix.Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/EDI-L/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/EDI-L/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/