NB: Updated info. Please go to my follow-up reply to this post.
I am just a bricoleur — perhaps I'm tripping over dried mortar.
General goal:
Remove from large amount of text (tens of thousands of characters) everything but what is contained between two different search terms.
Specific goal:
Copy source code of Web page, delete everything before a given marker, delete everything after a given marker.
Software:
OS 10.10.4
KM 7.0
Safari 8.0.7
I set this up using several instances of the Action:
Search and Replace Clipboard Using Regular Expression (case sensitive)
The instances are:
Remove LF/CR: Find "\R"; replace "{null}"
Remove all text before search term 1: Find "(.)(SearchTerm1)"; replace "{null}"
Remove all text after search term 2: Find "(.)(SearchTerm2)"; replace "{null}"
Remove unwanted escape character: Find "{backslash}{backslash}"; replace "{null}"
Add line breaks: Find "SearchTerm3"; replace "\r"
I checked each regex using RegExRX (an excellent little program IME, although I am not qualified to judge). They all work. None took longer than 10 ms. to execute.
The first one — remove LF/CR — failed as a KM Action. I tried several variations, including Search and Replace Using String Matching with the search term "%Return% — all failed. I finally copied and pasted the invisible character from the page source into the search field in the macro, with the macro set to "String Matching". This worked.
I can't get any of the rest to work. As far as I can tell, KM does not hang — it just takes minutes to finish the four Actions. The MenuBar icon shows one of the four "corner dot; I am working" icons. The corner dot does not move for at least several minutes. Activity Monitor sometimes shows KM using one whole core (100% of quad-core MBP).
I have tried both case-sensitive and not case-sensitive.
I tried — after reading in this forum about a problem with the clipboard loading too slowly in KM 7.0 — starting the macro with the Action:
Set Copy/Paste Delay for This Macro to 1 Seconds
It made no difference.
I'm stumped. Any wisdom you can shine my way will be greatly appreciated.
—Kirby.