Stripping non-alphabetic characters out of a field

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Stripping non-alphabetic characters out of a field

  • Creator
    Topic
  • #47588
    Misti Wannamaker
    Participant

      I need to strip non-alphabetic characters out of the last name field.  We have STAR and we are sending records to our lab system, Misys.  Misys won’t accept non-alphabetic characters in the last name field.  How do I do this?

      Thanks for any help.

      Misti R. Wannamaker

      Systems Analyst

      TRMC

      803.395.2806

      mrwannamaker@regmed.com

    Viewing 4 reply threads
    • Author
      Replies
      • #56182
        Robert Milfajt
        Participant

          regsub -all {[^A-Z,a-z]} $x “” y

          ought to do the trick, where x is the input string and y is the output string.

          Hope this helps,

          Bob

          Robert Milfajt
          Northwestern Medicine
          Chicago, IL

        • #56183
          Misti Wannamaker
          Participant

            Thanks for responding.  I’ll try it.

          • #56184
            Traci Zee
            Participant

              As a corollary:

              How do I substitute ” for all characters out of a string that are > 0x7e?

              I’ve tried: regsub -all {[\x7e-\xff]} $str {“} outstr

              and it errors with:

              couldn’t compile regular expression pattern: invalid [] range

                 while executing

              “regsub -all {[\x7e-\xff]} $str {“} outstr”

              I can’t get the right syntax for the hex values in the range.

              TIA!

              Traci Zee

              770.844.9242

              Emdeon, Inc.

            • #56185
              Jim Kosloskey
              Participant

                Traci,

                I think you might have too many .

                Try this:

                regsub -all {[x7e-xff]} $str {“} outstr

                That seemed to work for me in hcitcl.

                Sure hope this isn’t HL/7; you get a 2 byte string which converts to “”; and the receiving system is sensitive to Active Null.

                Jim Kosloskey

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

              • #56186
                Jamin Gray
                Participant

                  Robert Milfajt wrote:

                  regsub -all {[^A-Z,a-z]} $x “” y

                  ought to do the trick, where x is the input string and y is the output string.

                  Hope this helps,

                  Bob

                  This will also leave commas in the field.  If the system barks at anything but alphas you might want to change it to:

                  Code:


                  regsub -all {[^A-Za-z]} $x {} y

                  or

                  Code:


                  regsub -all -nocase {[^a-z]} $x {} y

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