09-15-2016, 05:16 PM
Add .+ at the beginning of the regular expression. It skips as much as possible, until the last match.
Macro Macro490
Macro Macro490
;set clipboard text for testing
str s1=
;...
;... start
;A contract ...
;...
;... start B contract ...
;...
;... start C contract ...
s1.setclip
;--------------
;macro
str s.getclip
if(s.len=0) ret
str a; int i
findrx(s "(?s)^.+\b(start\b.+?\bcontract)\b" 0 0 a 1)
;remove (?s) if text between start and contract cannot be multiline
;results
out a