Line changing whitespace characters are not all the same which can cause some problems. Sometimes Words() can be clean option for something like this
Names Default To Here(1);
nw = New Window("This is a script box",
H List Box(
Panel Box("Long Script",
sb1 = Script Box(
"print(\!" Hello\!");
print(\!" Hello\!");
print(\!" Hello\!");
// comment
print(\!" Hello\!");
// comment
print(\!" Hello\!");",
600,
500
);
),
sb2 = Script Box(, 600, 500)
)
);
// You can also clear tabs if you wish to \t (regex) or \!t (jmp)
Wait(1);
sb2 << Set Text(Regex(sb1 << get text, "[\r\n]+", "\!N", GLOBALREPLACE));
sb2 << reformat;
Wait(1);
sb2 << Set Text("");
Wait(1);
sb2 << Set Text(Concat Items(Words(sb1 << get text, "\!N"), "\!N"));
sb2 << reformat;
Wait(1);
sb2 << Set Text("");
Wait(1);
lines = sb1 << get lines;
empty = Loc(ls, "");
sb2 << Set Text(Concat Items(Remove(lines, As List(empty)), "\!N"));
sb2 << reformat;
In JMP
![jthi_0-1726034628624.png jthi_0-1726034628624.png](/t5/image/serverpage/image-id/68113i24B8254DDAA8C27E/image-size/large?v=v2&px=999)
JSL Syntax Rules (jmp.com)
In regex (usually)
![jthi_1-1726034690030.png jthi_1-1726034690030.png](/t5/image/serverpage/image-id/68114iF3BA852A18D46775/image-size/medium?v=v2&px=400)
-Jarmo