Suppose I have the following Python string
str = """
....
Dummyline
Start of matching
+----------+----------------------------+
+ test + 1234 +
+ test2 + 5678 +
+----------+----------------------------+
Finish above. Do not match this
+----------+----------------------------+
+ dummy1 + 00000000000 +
+ dummy2 + 12345678910 +
+----------+----------------------------+
"""
and I want to match everything that the first table has. I could use a regex that starts matching from
"Start"
and matches everything until it finds a double newline
\n\n
I found some tips on how to do this in another stackoverflow post (How to match "anything up until this sequence of characters" in a regular expression?), but it doesn't seem to be working for the double newline case.
I thought of the following code
pattern = re.compile(r"Start[^\n\n]")
matches = pattern.finditer(str)
where basically
[^x]
means match everything until character x is found. But this works only for characters, not with strings ("\n\n" in this case)
Anybody has any idea on it?