Find a specific string format in a segment

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Find a specific string format in a segment

  • Creator
    Topic
  • #54135
    Dustin Sayes
    Participant

      Howdy,

      I want to search a line of HL7 and find anything that reflects a specific format.

      Like this:

      #In this example the SSN is 011-22-3348

      #I need to be able to find anything that matches a SSN format, store it to a variable and ultimately put it back in the message as xxx-xx-3348

      #How does one scan, using TCL, to find a specific format?

      #I have been sing the string scan $var1 $var2, but no luck yet.

      PID|1||M000000115^^^YVMC.TEST5.66^MR^YVMC~011-22-3348^^^YVMC.TEST5.66^SS^YVMC

    Viewing 1 reply thread
    • Author
      Replies
      • #80286
        Keith McLeod
        Participant

          How about something like:

          regsub -all — {d{3}-d{2}-(d{4})} $msg {xxx-xx-1} newmsg

        • #80287
          Dustin Sayes
          Participant

            Perfect.

            Thank you!

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