Forum Discussion

JulieMeeker's avatar
JulieMeeker
Qrew Trainee
3 years ago

RegEx Expression to recognize 2 patterns in the same text field

I have read that you can search for two different patterns but even using the pythex tool I can not seem to get it to work.  I need to end up with a value for each line.  Legacy package tags have a "Space"&00 at the beginning and those created in QB do not.  I had it working with just the legacy tags with this statement ([^ 00;$]+).
Here is a sample.  
347211
346998
 00346924
 00346932
347078
347381
347002
 00330052
 00346879
 00343886
 00343891
 00343889
 00343890
 00343885
 00343887
 00343883
 00343881
 00343880
 00343907
 00343914
 00343909
 00343906
 00343911
 00343912
 00343905
 00330050
 00330049
 00330053
 00330051
 00344358
 00343467
 00346819
 00344359
 00295255
347329
347330
 00346944
347262
 00344295
347320
 00346822
 00346905
347100
 00346670
347335
347100
347116
347086
347100
347335
 00346670
347021
347021
 00346670
347335
 00346820
 00346821
347196
 00330884
347255
 00295256
347196
347115

------------------------------
Julie Meeker
In Over My Head!
------------------------------

3 Replies

  • AustinK's avatar
    AustinK
    Qrew Commander
    Can you explain more about what your intentions are here? Are these in a list with other numbers that are not shown here or is the list entirely composed of those 2 different patterns?
    • JulieMeeker's avatar
      JulieMeeker
      Qrew Trainee
      Yes, the list is entirely composed of those 2 patterns.  One is a legacy tag (it has the leading space and 00) and the rest were generated out of QB

      ------------------------------
      Julie Meeker
      ------------------------------
      • AustinK's avatar
        AustinK
        Qrew Commander
        The thing I don't understand here is if your list is composed entirely of those numbers and you want a regex that can match both of them, wouldn't that not get you anywhere? It would match everything in the list in the end and not differentiate between them.

        That is why I was asking what your intentions here were. You mentioned needing to end up with a value for each line, what did you mean by this? Are you wanting to find the old legacy lines and manipulate that line in some way like adding more text, and then manipulate the new QB tag lines in a different way? Or would they both be changed in the same way?