I need a regex expression that finds a match when the sentence "SENTENCE TO MATCH" is found between "START1" and the first "end". the problem I have got is that the search should stop at the first "end" (that is related to START1). The expression that I worked out so far:
START1[\s\S]asterix?SENTENCE TO MATCH[\s\S]*?end
works in this case:
START1
text
SENTENCE TO MATCH
text
end
START2
text
end
but it gives me a false positive in this case where I want a no match
START1
text
end
START2
text
SENTENCE TO MATCH
text
end
any help is much appreciated. thanks