Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extracting text from clipboard
#6
Add .+ at the beginning of the regular expression. It skips as much as possible, until the last match.

Macro Macro490
Code:
Copy      Help
;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


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)