I have a situation where I need to build a string that will be passed to an external program. I need to use Eval Insert in building the string but the string also needs to contain a RegEx which includes the ^ character.
I am struggling to get JMP ( Version 19.1.4) to ignore that character in the Eval Insert call. Here is a sample :
Str_To_Eval = "Insert_Str";
str = "This is a String containing ^Str_To_Eval^ and it also contains this regex : ^(?!.*_).*";
eval insert(str)
This fails with the error :
Unexpected "?". Perhaps there is a missing ")".
Line 1 Column 37: (?!.*_).*►
Prefixing the ^ character with \! does not help. Neither does wrapping it in \[ ..]\
I can solve it like this :
Str_To_Eval = "Insert_Str";
RegExFragment = "^";
str = "This is a String containing ^Str_To_Eval^ and it also contains this regex : ^RegExFragment^(?!.*_).*";
eval insert(str);
which gives the output I want.
I was curious if there's any other way to escape a ^ character so that Eval Insert() would ignore it ?
Use different character than ^. I usually use ¤.
Names Default To Here(1);
Eval Insert("Today is ¤As Date(Today())¤", "¤");
Eval Insert(string, , , < <)

Thanks ! I can't believe I've been using JMP for ~ 2 decades and never realized Eval Insert() had an optional argument to specify the delimiter ! Sometimes it pays to read the manual 