Skip to content Skip to sidebar Skip to footer

Grab Required Field Values From The Paragraph Block Using Regex In Python

I've a text file, from that I have extracted these two paragraph block. The text example is given below. Text Example: EXONERAR, com validade a contar de 19 de agosto de 2020, DE-

Solution 1:

For the bold uppercase parts, you can add an alternation, matching 1 or more uppercase words separated by a whitespace char or a hyphen and that end with a comma.

\b([A-Z]+(?:[\s-]+[A-Z]+)+(?=,)

Regex demo for the full pattern

Post a Comment for "Grab Required Field Values From The Paragraph Block Using Regex In Python"