Reply To: HL7 Help

Clovertech Forums Read Only Archives Cloverleaf General HL7 Help Reply To: HL7 Help

#57043
Charlie Bursell
Participant

    My $0.02

    A change like this is best done with the string map command.

    The problem is that sometimes you don’t know or care what the character is but you want to make sure it is what you want.  All you will deal with is the character at index 3, 4, etc.

    If you use regsub, you never know if the character is a regsub special character.  For example, the ^ character is the character that anchors the expression to the beginning of a string.  To regsub it, you would have to escape it.  With the new regular expression engine, it is an error to escape a non-special character.

    So you are better off to use string map which requires no escaping.  For example, assume you want to change the subfield separator to : throughout the message.

    set msg [string map “[string index $msg 4] :” $msg]

    Charlie