I have an output which has some hearders and some values under it. I want to capture everything which is after the header. i tried writing a pattern to match the header and take out lines after it. but the regex captures just one line after the header. how do i extend to multiple lines
my_str = '''
-------------------------------------
A B C D E F G
-------------------------------------
1 2 3 4 5 6 7
2 3 4 5 6 7 8
3 4 5 6 7 8 9
'''
import re
pat = '--+n.*n--+n(.*)'
match = re.search(pat, my_str, re.M)
if match:
print(match.groups())
This captures just one line as below
('1 2 3 4 5 6 7',)
but i would like to capture everything after the pattern match so that my output should look like this
('1 2 3 4 5 6 7', '2 3 4 5 6 7 8','3 4 5 6 7 8 9')
i dont want to use findall and match the pattern because im worried if my output changes at any point in time like removal / adding some fields. so I want to extract everything after the pattern.