Start with the header
Open the HL7 Message Analyzer and paste the synthetic message below. It is an inspection fixture, not a complete clinical message or proof of conformance.
MSH-1 is the field separator itself. MSH-2 contains the encoding characters; MSH-3 is the sending application. Counting every pipe-separated item as an ordinary field shifts the header. The HL7 MSH reference identifies those positions.
MSH|^~\&|SYNTHETIC|LOCAL|RECEIVER|LOCAL|202609140900||ADT^A01|GUIDE-001|T|2.5.1
PID|1||SYN-001^^^LOCAL^MR~SYN-002^^^OTHER^MR||EXAMPLE^SYNTHETIC
NTE|1||Encoded separator: \F\Inspect a repeated field
Choose PID, then PID-3. With these delimiters, ~ separates repetitions, ^ separates components and & separates subcomponents. Empty components still occupy positions: the second identifier has OTHER in component 4. Expected observations:
MSH-1: |
MSH-2: ^~\&
MSH-3: SYNTHETIC
PID-3 repetitions: 2
PID-3[2].4: OTHER
NTE-3: Encoded separator: \F\
In module code, call inspectField(segment, 3) with the original segment returned by analyzeHL7. Its one-based paths describe repetitions, components and subcomponents. Re-analyze a serialized or cloned result before inspecting it.
Read separators from the message
The analyzer accepts distinct visible ASCII punctuation separators. This equivalent inspection fixture declares a field separator of *; MSH-2 declares component, repetition, escape and subcomponent separators in that order.
MSH*$%!@*SYNTHETIC*LOCAL*RECEIVER*LOCAL*202609140900**ADT$A01*GUIDE-002*T*2.5.1
PID*1**SYN-001$$$LOCAL$MR%SYN-002$$$OTHER$MR**EXAMPLE$SYNTHETIC
Delimiters: field=* component=$ repetition=% escape=! subcomponent=@
PID-3 repetitions: 2
PID-5[1].1: EXAMPLEKeep encoding and transport limits in view
- Escape text remains encoded:
\F\stays\F\. Paired escapes protect embedded delimiters from splitting; the analyzer does not decode escapes or check their full grammar. Unmatched escapes produce a warning. - A fifth MSH-2 truncation character is retained with a warning; truncation semantics are not interpreted.
- One message with CR, LF or CRLF breaks is accepted, including a single MLLP frame. Multiple messages, batch wrappers and prefixed log text are rejected.
- Copy and Download use normalized message text: supported framing and blank lines are removed, segments use CR, and one final CR is added. This does not preserve original transport bytes.
- Limits are 1 MiB of UTF-8 input, 2,000 segments and 50,000 structural parts. Header checks and common field labels do not establish message structure, datatype, terminology or profile conformance.
All examples are synthetic. Use the linked tool to reproduce the result.
Browse all developer guides · Open HL7 analyzer