Regular Expression Problem

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Regular Expression Problem

  • Creator
    Topic
  • #49854
    Deanna Norman
    Participant

      Hi,

      I am trying to use the regsub function to strip out the rtf formatting using the regular expression \w+|{.*?}

      The above regular expression works fine in a test app I wrote using .NET, but not in TCL. Can anybody see why? My statement is below:

      regsub -all \w+|{.*?} $OBX5 “” CleanOBX5

      I get no value in the variable $CleanOBX5

      Thanks,

    Viewing 0 reply threads
    • Author
      Replies
      • #63883

        In tcl, it’s a good idea to wrap your regexps in braces.

        Code:

        regsub -all {…} $var1 {} var2

        Try this …

        Code:

        regsub -all {w+|{.*?} $OBX5 {} CleanOBX5

        I’m assuming your using the “|” as “or”. If not, you will need to escapte it with | like you did with the braces.

        Code:

        regsub -all {w+|{.*?} $OBX5 {} CleanOBX5

        -- Max Drown (Infor)

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