Word Replacement Question / TCL

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Word Replacement Question / TCL

  • Creator
    Topic
  • #53722
    Jon Melin
    Participant

      Hi. I have an interesting question about replacing a certain word in a file with a number. I have done searches by segment and used regsub to substitute characters before but the document I am trying to replace these words in are not structured in any certain way.

      Here is random example I mocked up. I need to walk through a document that looks likes this (but much longer):

      RE*LL*REPLACEMENT*RECVID*ISL*01*

      ISA*00*

      AH*2*222

      And replace the word REPLACEMENT with 54789612 so it would look like:

      RE*LL*54789612*RECVID*ISL*01*

      ISA*00*

      AH*2*222

      So it isn’t valid HL7, and the REPLACEMENT word can be in the document anywhere and any number of times. Essentially I want to automate a FIND AND REPLACE using TCL or any other function in Cloverleaf. Any thoughts? I don’t think a regsub will work for the whole document will it?

      Thank you in advance

    Viewing 1 reply thread
    • Author
      Replies
      • #78726
        Jim Kosloskey
        Participant

          Jon,

          It isn’t HL/7 at all it is X12.

          Is this an inbound message?

          If so then you can use regsub in a TPS proc to address the entire message (probably pre-xlate) and then regsub will work against the whole message.

          email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 60 years IT – old fart.

        • #78727
          Jon Melin
          Participant

            Sorry I shouldn’t have said isn’t valid HL7, I meant to say it isn’t HL7 – I’ve never had experience with X12 before.

            Yes this is the inbound message.

            I will see what I can do with RegSub. Thanks

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