I have a file I want to extract data from using regex that looks like this :
RID: RSS-130 SERVICE PAGE: 2
REPORTING FOR: 100019912 SSSE INTSERVICE PROC DATE: 15SEP21
ROLLUP FOR: 100076212 SSSE REPORT REPORT DATE: 15SEP21
ENTITY: 1000208212 SSSE
ACQT
PUR
SAME 10SEP21 120 12,263,518 19,48.5
T PUR 120 12,263,518 19,48.5
The regex I wrote to extract the data :
regex_1 = PROC DATE:\s*(\w+).?* # to get 15SEP21
regex_2 = T PUR\s*([0-9,]*\s*[0-9,]*) # to get the first two elements of the line after T PUR
This works but in the file I have multiple records just like this one, under different RID: RSS-130
for example RID: RSS-140
, I want to enforce extracting information only that follows RID: RSS-130
and ACQT
and stop when that record is over and not carry on extracting data from what ever is under How can I do that?
Desired output would be :
[(15SEP21;120;12,263,518)]
for the record that comes under RID: RSS-130
and after ACQT
only