09-15-2016, 05:46 PM
With regular expression I don't know how, but can remove the first "start..." later.
Macro Macro471
Macro Macro471
;set clipboard text for testing
str s1=
;... start
;A ...
;...
;... start B
;contract ...
;...
;... start C contract ...
s1.setclip
;--------------
;macro
str s.getclip
if(s.len=0) ret
ARRAY(str) a; int i
findrx(s "(?s)\bstart\b.+?\bcontract\b" 0 4 a)
;remove (?s) if text between start and contract cannot be multiline
;results
for i 0 a.len
,str& r=a[0 i]
,int j=FindLast(r "start" 2)
,if(j>0) r.remove(0 j)
,out r