iNTERFACEWARE Products Manual > Installing and Using Chameleon > Using Python Scripting > Python Scripting Examples > Message Manipulation > Removing Trailing Vertical Bar Characters |
|
Looking for Iguana v.5 or v.6? Learn More or see the Help Center.
If an HL7 message contains segments with unwanted trailing vertical bar | characters, the following Python transformation script will remove them:
The re.sub() function looks for any occurrence of one or more vertical bar characters followed by the carriage return character. This can only occur if unwanted trailing vertical bar characters exist. re.sub() removes these vertical bar characters, and assigns the result to value. For example, suppose that you have the following message:
This script will produce the following:
|