tcl script to remove \.br\

Clovertech Forums Cloverleaf tcl script to remove \.br\

  • Creator
    Topic
  • #115732
    Alison Benecchi
    Participant

      I’m looking for a tcl script to remove the \.br\ and replace with a space in RXE7-1 but having problems with my script.  Looking for suggestions.

      Here it is:

      set RXE7_1 [getField $msg RXE7_1]
      set Br “\.br\””
      puts $Br

      if {[cequal $RXE7_1 $Br]} {
      set msg [setField $RXE7_1 $msg RXE7]
      regsub -all {“\.br\”} $RXE7_1 { } RXE7_1
      # lreplace $RXE.7 “\.br\” ” ”
      }

       

       

    Viewing 4 reply threads
    • Author
      Replies
      • #115734
        Vince Angulo
        Participant

          Try an extra set of back slashes:  I use this statement to replace line breaks in entire segments:

           

          regsub -all — {\\.br\\} $segid { } newseg

        • #115735
          Tipu Razaq
          Participant

            we’ve done this in an xlate:

             

            lset xlateOutVals 0 [regsub -all — {\\.br\\} [lindex $xlateInVals 0] ” “];

             

            Perhaps you just have to escape the \ like so, remove the quotes, use ” ” for the space:

             

            regsub -all {\\.br\\} $RXE7_1 ” ” RXE7_1

          • #115741
            Jim Kosloskey
            Participant

              If your release has the STRING Action you can use that I think.

              email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

            • #115758
              David Barr
              Participant

                Technically, you should say {\\\.br\\} so that the period will be a literal period rather than a special character. The pattern {\\.br\\} will also match \xbr\. You might be better off using “string map” for this replacement since it doesn’t need any special expression.

              • #115767
                Charlie Bursell
                Participant

                  I agree with Jim.  Use <code class=”ph codeph”>xlateStrMap ?nocase? mapping</code>

                  Same use as the string map command in Tcl

              Viewing 4 reply threads
              • You must be logged in to reply to this topic.