Following text data given i am experiencing strange capturing group behavior. When i try to iterate over all tables only the last row of data. Is there a way to maintain all capturing groups not only the last row (values of each table)?
I am using this pattern (?<tabname>\S+)\n\=*\n(?:(\d+)\ *\|\ *(\d+)\n)+
TABLE1
=======
1 | 2
15 | 2
3 | 15
TABLE2
=======
3 | 5
12 | 2
17 | 7
Edit: Sorry for my inconsistent question, here my expected and actual outputs:
Expected output would be:
Match 1 of 2:
Group "tabname": TABLE1
Group 2: 1
Group 3: 2
Group 4: 15
Group 5: 2
Group 6: 3
Group 7: 15
Match 2 of 2:
Group "tabname": TABLE2
Group 2: 3
Group 3: 5
Group 4: 12
Group 5: 2
Group 6: 17
Group 7: 7
But actual output is:
Match 1 of 2:
Group "tabname": TABLE1
Group 2: 3
Group 3: 15
Match 2 of 2:
Group "tabname": TABLE1
Group 2: 17
Group 3: 7