Untitled
import re last_part = """PREVIOUS-PACKAGE-ID RECORDS-PROCESSED QUEUE-COUNT TRIGGERED-COUNT RECYCLED-COUNT SMALL-CLAIMS-COUNT LARGE-CLAIMS-COUNT INCLUDE-PACKAGE IN-PROCESS-COUNT DSPLY-RETURN-CODE RECYCLED-CLAIM-WAIT-HOURS OF ZCNTL-PARAMS RECYCLED-CLAIM-WAIT-HOURS OF WS-SCOPE-QADPC0R1 QUEUED-CLAIM-WAIT-HOURS OF WS-SCOPE-QADPC0R1 MAPKG-ID OF WS-SCOPE-QADPC0U3 MAPKG-ID OF WS-SCOPE-QADPC0U5 MAPKG-ID OF WS-SCOPE-QMAPS0E1 MAPKG-ID OF WS-SCOPE-QMAPK0U1 . ESDF-DFG CSDF OF D EDFG OF D(SUB) CRT OF SERD-RT (1:0) STATUS-CODE OF AS-ET OF ERT""" # Updated regex pattern to handle cascading OF clauses and parentheses pattern = r""" \b[\w-]+ # Match the first part (alphanumeric and hyphenated words) (?:\s+OF\s+[\w-]+ # Match cascading 'OF' clauses (?:\([\w-]+\))? # Match optional parentheses directly connected to 'OF' )* # Allow multiple cascading 'OF' clauses (?:\s+\([\w:]+\))? # Match optional standalone parentheses like (1:0) """ # Find matches using re.finditer and ignore whitespace in the regex pattern (re.VERBOSE) values = [match.group(0).strip() for match in re.finditer(pattern, last_part, re.VERBOSE)] print("VALUES:", values)
Leave a Comment