regsub – changing T in the URL to &

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf regsub – changing T in the URL to &

  • Creator
    Topic
  • #47993
    Barbi
    Participant

      Here is the code I am using:

      regsub -all {\T\$} $xlateInVals {&} xlateOutVals

      I need to change the T to and &.  

      thanks

      Barbi

    Viewing 2 reply threads
    • Author
      Replies
      • #57248
        Barbi
        Participant

          Here is the code that will work.  

          regsub -all {\T\} $xlateInVals {&} xlateOutVals

        • #57249
          Charlie Bursell
          Participant

            So will the string command:

            set xlateOutVals [string map {\T\ &} $xlateInVals]

            I usually don’t like to use string commands on a list but since you are setting a list, its OK

            FWIW, the string command isa bit more ergonomic when doing minor changes.  Its more optimized and designed to do a specific task.

            And, the nice thing is you don’t have to worry about escaping regular expression special characters

          • #57250
            David Barr
            Participant

              I don’t think a simple regsub will work for all cases.

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