My test result in regexr dot com
I'm trying to capture the shortest match in multiline text, and stop check if the beginning pattern appears again before the whole pattern is found.
Pattern with issue:
test2(.|\n)*?test4
Input:
1 test1
2 test2
5 test5
6 test1
7 test2
8 test3
9 test4
10 test5
11 test1
12 test2
13 test3
14 test4
15 test5
Expected 2 result:
First: line 7 till line 9
Second: line 12 till line 14
Actual (unwanted) result:
First: line 2 till line 9
Second: line 12 till line 14