with python and regex I attempt to match repeating/overlapping patterns/blocks like
04/00127-48
U 05062012
A: SAKARK
T_ Par.: dsfsd
in
04/00127-48
U 05062012
A: SAKARK
T_ Par.: dsfsd
04/00168-42
U 05062012
A: SAKARK
T_ Par.: fdfs
04/00168-43
U 05062012
A: SAKARK
T_ Par.: fdfs
I have tried
'(?=(\d+\/.*))'
this seem to work
'((\d+\/.*?)=?\d+\/)
but is there a better approach?
This answers your question:
re.DOTALLis needed to let the.match end-of-lines.The
rin front of the regex makes it a raw string so escapes with backslash are left as they are so the regex function will handle them. It is not needed here but still a good habit for regex’s.Your question is not very clear. Maybe this matches better what you want?
It gives a list with tuples.