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 (SUB-SDF) CRT OF SERD-RT (1:0) STATUS-CODE OF AS-ET OF ERT ASDF OF DFG (SRE-ER) ADFF OF ERTER(SUB-RTY)""" # Enhanced regex pattern to capture cascading OF clauses and parentheses pattern = r""" \b[\w-]+ # Match a word or hyphenated word (?:\s+OF\s+[\w-]+(?:\([\w-]+\))?)* # Match cascading OF clauses with optional parentheses (?:\s+\([\w:\s-]+\))? # Match optional parentheses with nested elements or ranges """ # Find matches using re.finditer and ignore whitespace in the regex pattern (re.VERBOSE) values1 = [match.group(0).strip() for match in re.finditer(pattern, last_part, re.VERBOSE)] print("VALUES:", values1)
Leave a Comment