How to use regular expressions, Replace the item fields in the Autotext (Divided into three segments, each with a tab indent), As the picture below looks like
How to modify?
"(?m)^(?:#sub +(\w+))"
The following code has a minor problem that will be reordered, for example,
The original order of the items is
Sub3
Sub2
Sub1
Sub4
But after processing, the order becomes
Sub1
Sub2
Sub3
Sub4
How to save the original order?
Autotext test
Trigger $t
How to modify?
"(?m)^(?:#sub +(\w+))"
The following code has a minor problem that will be reordered, for example,
The original order of the items is
Sub3
Sub2
Sub1
Sub4
But after processing, the order becomes
Sub1
Sub2
Sub3
Sub4
How to save the original order?
#sub gotoitemedit
function~ ~name
str s.getmacro(name 0); if(!s.len) ret
ARRAY(CHARRANGE)+ a; int i
if(0=findrx(s "(?m)^(?:#sub +(\w+))" 0 4 a)) ret
str items t
for i 0 a.len
int isBM=s[a[0 i].cpMin]!='#'
CHARRANGE& r=a[1+isBM i]
int n=r.cpMax-r.cpMin; if(n>0) t.get(s r.cpMin n); t.trim; else t=""
items.formata("%i %s[]" isBM t)
ret items
Autotext test
Trigger $t
/b/i/c/m
ta :sub.Sub3 ;;tc Comment
ta :sub.Sub2 ;;tb Comment
ta :sub.Sub1 ;;ta Comment
ta :sub.Sub4 ;;td Comment
#sub Sub1 m
_s=
F
;ta test
PasteAutoInputDialog(_s)
#sub Sub2 m
_s=
F
;tb test
PasteAutoInputDialog(_s)
#sub Sub3 m
_s=
F
;tc test
PasteAutoInputDialog(_s)
#sub Sub4 m
_s=
F
;td test
PasteAutoInputDialog(_s)