Tcl help

  • Creator
    Topic
  • #48556
    Anonymous
    Participant

      I have an account number that is 13 digits long.  Sometimes that number comes across as all zero’s, or all ones or something like that.  I want to be able to check to see if all 13 digits are the same and if so, kill the message.   Right now, I’m using a switch statement that has:

      0000000000000 –

      1111111111111 –

      2222222222222 –

      9999999999999 { do something here }

      I’ve been tinkering with the regexp but can’t find a combination that works, if it works at all.  Is there a less intensive way of doing this or is this switch the best solution there is?

      Thanks….

      Thomas G. Rioux

      The Methodist Hospital

    Viewing 4 reply threads
    • Author
      Replies
      • #58986
        Charlie Bursell
        Participant

          Assumming you are sure the number is always 12 digit, something like

          regexp — {^(d)1{11}} $num

          will work

        • #58987
          Anonymous
          Participant

            Very good Charlie you are the best.

            Got any good books on expression?

            I always run into trouble with them then turn around and do it the hard way.

          • #58988
            Charlie Bursell
            Participant

              There is a very good chapter in Brent Welch’s Tcl book, 4th edition.

            • #58989

              OReilly’s Mastering Regular Expressions is a wonderful book.

              -- Max Drown (Infor)

            • #58990

              Oh and that is indeed an awesome regular expresion, Charlie! Very nice.

              -- Max Drown (Infor)

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