I am reading a PDF text, and isolating a table. I am then splitting the table data up into seperate substrings in an array.
I am trying to split the substring data up, to get a name, a set of dates, and a cost value. The data is split up by spaces, and looks something like the data below (required values are in bold):
Scheduled Payment Mr John Smith 01/10/20-31/10/20 2,444.44
Scheduled Payment Mrs Paula Smith 01/10/20-31/10/20 5,283.98
Scheduled Payment Miss Susan May Smith 01/10/20-31/10/20 1,000.01
19423492 Sample Company Name (01)
Scheduled Payment Mr John Jones 01/10/20-31/10/20 2,444.44
Scheduled Payment Mrs Jess Mae Jones 01/10/20-31/10/20 5,283.98
Scheduled Payment Miss Susan Jess Jones 01/10/20-31/10/20 1,000.01
The data is semi consistent, the only things that will change is the cost value, and the name may have a middle name in, like the third line of the example. All of the “Scheduled Payments” are in groups under a company name.
What is the most efficient way of splitting up these values and assigning the sections to variables? I was thinking of a regex, but I can’t get my head around them. Could someone help?
Thanks in advance.