I'm having a problem with regex and bracket characters.
This JSL snippet:
Show(Regex("abcdef[ghi]", "([^\[]*)\[([^\]]*)\]", "\1{\2}"))
doesn't work in JMP (14.1). It gives the following error:
Unexpected "([^]*)\[([^\]]*)\]", "\1{\2}"))". Perhaps there is a missing "," or ")".
Trying to parse arguments of function "Regex".
However, this is valid regex in my Perl regex tester. ( I use Patterns on OS X.) In that environment, inputting:
abcdef[ghi]
to the Regular Expression
([^\[]*)\[([^\]]*)\]
using the Replacement value of
$1{$2}
yields the result
abcdef{ghi}
(The Perl expression is
$searchText =~ s/([^\[]*)\[([^\]]*)\]/$1{$2}/gism;
).
What is going on? Does JMP regex engine need some other way of escaping bracket characters?
Thanks.