title: HL7 Encoding/Separator Characters
body: <p>In regards to HL7 pipe-delimited data, how exactly do the encoding characters (|^~\&amp;) work? </p>
  
  <p><strong>Is the following example of fields, field repetitions, components and their sub-components correct when parsing raw HL7 data?</strong> </p>
  
  <pre><code>PID|1||||||||||||1234567890^somedata&amp;moredata^TESTEMAIL@GMAIL.COM~0987654321
  
  Field (|): 
  PID13 = 1234567890^somedata&amp;moredata^TESTEMAIL@GMAIL.COM~0987654321
  
  Field repetition (~): 
  PID13~1 = 1234567890^somedata&amp;moredata^TESTEMAIL@GMAIL.COM
  PID13~2 = 0987654321 
  
  Component (^):
  PID13.1 = 1234567890
  PID13.2 = somedata&amp;moredata
  PID13.3 = TESTEMAIL@GMAIL.COM
  
  Sub-component (&amp;):
  PID13.2.1 = somedata
  PID13.2.2 = moredata
  PID13.3.1 = TESTEMAIL@GMAIL.COM
  PID13.3.2 = 
  </code></pre>