2 Replies Latest reply: Jan 10, 2014 2:50 PM by Robert Fishel RSS

    String Pattern Matching

    Robert Fishel

      Hello my QV friends.  I am trying to figure out the best way to find string patterns.  For example, the string in question, if it has values for all sections, can look like this:

       

      1234*12345678*1234567891*12345678*1234

       

      So that would be 4 characters, asterisk, then 8, asterisk, 10, asterisk, 8, asterisk and then 4.

       

      However, some times there may not be a value in the first section of 8, like this:

      1234**1234567891*12345678*1234

       

      Or maybe sometimes it can be like this:

      1234*12345678**12345678*1234

       

      Should I be using WILDMATCH for this?  I am trying to capture all possible variations.  Any other ideas?  Thank you.

       

      *****UPDATE******

      I have been working on this now for a little while and have the following:

       

      TEST: LOAD SAP_GL_CODE,   IF(LEN(SAP_GL_CODE) = 38 AND ,'YES','NO') AS TEST,   IF(SAP_GL_CODE LIKE '????' & chr(42) & '????????' &chr(42)& '??????????' &chr(42)& '????????' &chr(42)& '????','YES','NO') AS ALL RESIDENT DATA;

       

      The code works.

       

      My problem now is that if I put something like

       

      IF(SAP_GL_CODE LIKE '????' & chr(42) & chr(42) & '??????????' &chr(42)& '????????' &chr(42)& '????','YES','NO') AS NOT_ALL

       

      this code doesn't work.  Does anyone know how to write two chr()'s back to back??  Thanks.