regsub

  • Creator
    Topic
  • #51588
    Bob Schmid
    Participant

      want to replace every occurrence of “S” in all of the obx segments with the character “;”

      dont want to replace S when found in NTES…..other segments

      regsub -all …?

      THanks

    Viewing 1 reply thread
    • Author
      Replies
      • #70876
        Charlie Bursell
        Participant

          Easy enough in Tcl, a bit harder in Xlate

          assuming you have done the normal HL7 stuff

          set map

            foreach loc [lsearch -all -regexp $SEGMENTS {^OBX}] {

                  set obx [string map $map [lindex $SEGMENTS $loc]]

                  set SEGMENTS [lreplace $SEGMENTS $loc $loc $obx]

            }

            msgset $mh [join $SEGMENTS r]

            return “{CONTINUE $mh}”

        • #70877
          Bob Schmid
          Participant

            Thanks Charles!!

            I was thinking youd be giving me one of those 1 line regsub extravaganzas..but this works !!!

            Appreciate your Sunday time!

        Viewing 1 reply thread
        • The forum ‘Cloverleaf’ is closed to new topics and replies.