locked
How to implement a regex for this? RRS feed

  • Question

  • User-1104215994 posted

    Hi,

    I would like to use regex for a txt file as follows. What I want to do is to get the whole text if CRC is other than 00000000. The content of the file below has 2 blocks of data below. And I should get the second one after the regex operation.

     

    Any help please?

     

    best Regards.

     

    ========================================================================================
    GAME -> 1111     CPN -> 11111     DRAW -> 1111     TEAM ->(0)
    INPUT METHOD -> Slip     TYPE -> Event
    -------------------------------PLAY TRANSACTION DATA-------------------------------
    TERMINAL_ID -> 9999999     TRANSACTION -> 99999  TERMINAL TIME -> 10/08/2011 18:43:26
    USER -> 9999999     CRC -> EC677FC9     SYSTEM TIME -> 10/08/2011 18:43:28
    -----------------------------CANCEL TRANSACTION DATA-------------------------------
    TERMINAL_ID -> 0     TRANSACTION -> 0     TERMINAL TIME -> 01/01/1970 00:00:00
    USER -> 0     CRC -> 00000000     SYSTEM TIME -> 10/08/2011 18:44:03
    METHOD -> Barcode Read
    -----------------------------------------------------------------------------------
    MULTIPLE DRAWS -> 1     REMAINING DRAWS -> 1     MULTIPLIER -> 2    COLUMNS -> 2
    REMAINING ADRAWS -> 0     ADVANCED DRAWS -> 0   AMOUNT -> 2.00  
    START -> 1013     LAST -> 1013 
    STATUS ->Cross-Entry/Reconciliated (003)     BARCODE -> 111111111 1111111111 1111111111 PILOT[0]
      Std  Event  Min  Selection  Group
           574    04   F  :1      ---
           579    04   F  :1      ---
           581    03   F  :1      ---
           585    03   F  :1      ---
           586    04   F  :1(H)   ---
           588    03   SOG:4-6    ---
           582    03   F  :1      ---
    Requests -> 07
    Req_Mult -> 001
    Revision -> 1     Approval -> 0     Played -> 7


    ========================================================================================
    ========================================================================================
    GAME -> 1111     CPN -> 1111111 DRAW -> 1111     TEAM ->(0)
    INPUT METHOD -> Slip     TYPE -> Event
    -------------------------------PLAY TRANSACTION DATA-------------------------------
    TERMINAL_ID -> 9999999     TRANSACTION -> 999999  TERMINAL TIME -> 10/08/2011 20:58:09
    USER -> 99999   CRC -> C7B0908F     SYSTEM TIME -> 10/08/2011 20:58:11
    -----------------------------CANCEL TRANSACTION DATA-------------------------------
    TERMINAL_ID -> 1111111     TRANSACTION -> 96084     TERMINAL TIME -> 10/08/2011 20:58:45
    USER -> 1111111   CRC -> BD0187CD     SYSTEM TIME -> 10/08/2011 20:58:47
    METHOD -> Barcode Read
    -----------------------------------------------------------------------------------
    MULTIPLE DRAWS -> 1     REMAINING DRAWS -> 1     MULTIPLIER -> 2    COLUMNS -> 2
    REMAINING ADRAWS -> 0     ADVANCED DRAWS -> 0   AMOUNT -> 2.00  
    START -> 1013     LAST -> 1013 
    STATUS ->Cancelled (002)     BARCODE -> 1111111111 111111111 11111111 PILOT[0]
      Std  Event  Min  Selection  Group
           582    02   H/F:2/2    ---
           590    04   F  :2(H)   ---
           595    02   H/F:2/2    ---
           596    02   H/F:2/2    ---
           602    02   H/F:2/2    ---
    Requests -> 05
    Req_Mult -> 001
    Revision -> 1     Approval -> 0     Played -> 5


    ========================================================================================

    Friday, August 12, 2011 7:38 AM

Answers

  • User-1104215994 posted

    nevermind I changed it to this

    matcher.group(8).trim().equals("Cancelled (002)")

    and it works

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 12, 2011 9:00 AM

All replies

  • User-848116622 posted

    I hope by simply checking the string contains 'CRC -> 00000000; will help to solve your problem

    Friday, August 12, 2011 7:43 AM
  • User-1104215994 posted

    Not equal to 000000000

    Friday, August 12, 2011 7:55 AM
  • User-1104215994 posted

    nevermind I changed it to this

    matcher.group(8).trim().equals("Cancelled (002)")

    and it works

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 12, 2011 9:00 AM