Regex Required to capture 2 tables

Hi,

Is there any way by modifying the regex below it captures me 2 different tables which are a lot similar looking. Tables in the comments following this one @prasath17

System.Text.RegularExpressions.Regex.Match(arrItem(index),"(?.+)\s±\s+(?[\d.,-]+(?=\s))\s*(?[\d.,-]+(?=\s))\s*(?[\d.,-]+(?=\s))\s*(?[\d.,-]+(?=\s))\s*(?[\d.,-]+)").ToString

City of Yuma, Arizona
Capital Improvement Program
FY 2021 - FY 2025
DEPARTMENT SUMMARY

Department 2021 2022 2023 2024 2025 Total

Facilities Maintenance 751,000 1,205,000 284,500 715,000 50,000 3,005,500
General Government Parks 300,000 100,000 400,000
and Recreation Public 2,075,000 25,000 75,000 575,000 25,000 2,775,000
Safety Transportation 350,000 8,150,000 365,000 1,430,000 3,200,000 13,495,000
8,379,364 4,265,000 7,279,594 7,349,640 7,059,000 34,332,598
Wastewater Utility 5,695,000 12,500,000 4,100,000 6,700,000 1,700,000 30,695,000
Water Utility 13,527,500 10,585,000 5,410,000 5,110,000 2,660,000 37,292,500
YCNHA 20,366,288 20,366,288
TOTAL 51,444,152 36,730,000 17,514,094 21,979,640 14,694,000 142,361,886

@prasath17 ?

@rameezimtiaz - just had a look …but there are couple of things different between 2 tables …

One is having STcodes where the other does not

One is having close to 9 amt fields where the other is having only 6…

So its not easy to get the one Regex for both…I can try later and it may take lot of time

@prasath17 thanks for pointing out. I mistakenly gave wrong table link at first.
Please check this one instead of the 2 nd comment. Now the tables will seem more connected

@rameezimtiaz - Could you please check the highlighted portion …Something is not right? I see every row has 6 amt fields …especially the line after safety transportation I dont see any category name and “and Recreation Public” is it a separate line??

Check this pattern

There r 6 fields. And its parks and recreation public but its a mistake in pdf

@prasath17 can i get a regex to just get data from new table alone. We can work on combined regex later?

@rameezimtiaz - which table?

City of yuma
Department summary table

@rameezimtiaz - Because of the inconsistencies within the table elements, you can see two additional rows gets captured…you might have to remove that manually or programmatically

Regex Link

@prasath17 can we just get the department values from the table?

@rameezimtiaz - you can take the group 1 from the above regex.

still fetching everything. could u just post that part here?

@rameezimtiaz - Regexvar(0).groups(1).tostring

@prasath17 this will not work for me. I want a regex that just gives me only 7 departments

Want a regex that gives me highlighted part of the table

@rameezimtiaz - i am not positive, we fetch that info alone…

it would be better if you stick to your requirement…

Yes alone. The table structure requires so much string manipulation if i go with the regex u shared earlier. I can get my work done with zero string manipulation if i can get just departments.