Skip to content

qie.unescapeHL7

Signature: qie.unescapeHL7(value, field*, comp*, repeat*, escape*, subComp*, removeUnsupported*)

Returns: String unescapedValue - the unescaped value

Unescape the HL7 escaped value.

Note

'\X000d\' will be unescaped as CR ('\r').

Parameters

Type Name Description Default
String value the value to be unescaped
String field* (optional) the HL7 field delimiter character `
String comp* (optional) the HL7 field component delimiter character ^
String repeat* (optional) the HL7 field value repeat character ~
String escape* (optional) the HL7 escape character \
String subComp* (optional) the HL7 field sub-component character &
Boolean removeUnsupported* (optional) if true, unsupported escape sequences are removed (\H\, \N\, \Cxxyy\, \Mxxyyzz\, \Xdddd\, etc.) false

Example

var hl7Message = qie.parseHL7String("" +
   "MSH|^~\\&|SendingApp|SendingFac|ReceivingApp|ReceivingFac|202412051200||ADT^A01|123456|P|2.3\n" +
   "PID|1||12345^^^Hospital MRN||Doe^John^A^III||19700101|M|||\n");

var newName = "O'Reilly|Connor^\\Smith&Partners~Doe"; // Value with special characters
hl7Message.setNode('PID-5', qie.escapeHL7(newName));

var patientName = hl7Message.getNode("PID-5");
var patientNameUnescaped = qie.unescapeHL7(hl7Message.getNode("PID-5"));