TT - that does seem to work! Great!!!
For anyone curious, I have this:
A tiddler with this arbitrary text
title:tid
text: Welcome to TiddlyWiki <<foo , a unique [[non-linear]] xx <<foo bar>>notebook for.
And this is my testing code (at the moment):
<$set name=re value='(<<foo([^>])*?)([<]{2})'>
<$set name=txt filter='[[tid]get[text]]'>
txt: <<txt>><br><br>
list: <$list filter="[{tid}regexp<re>splitregexp<re>]">
</$list>
<br>
<$set name=pre filter="[{tid}regexp<re>splitregexp<re>first[]]">
pre:<<pre>>
<br><br>
<$set name=target filter="[{tid}regexp<re>splitregexp<re>nth[2]]">
target: <<target>>
<br><br>
<$set name=post filter="[{tid}regexp<re>splitregexp<re>rest[2]]">
post: <<post>>
</$set>
</$set>
</$set>
</$set>
</$set>
To be clear, the application in EditorMagic is to be replace the incomplete macro call with a complete one and to keep the surrounding text (the pre and the post) intact. In the above setup, the "target" contains
Other than the added square brackets that mess up the link ([[non-linear]]) I'll have to split the real target, i.e <<foo from the rest and prepend the rest to the "post" text. So ideally, the regexp would cover that IF it says "<<foo blabla <<" THEN it should ONLY capture "<<foo" rather than include the blabla with it. I'm guessing this is too complex for a regex and will have to be done manually.
<:-)