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.
How to deal with this combination:The range of reservations is from ":[{" start、 to end "]".
abcdef{:[[ghi]]:[{op},{q}]}Need to get:
[{op},{q}]So how to write JSL. Thank you very much!
I made a mistake.Writing code like this doesn't get you the right result.
c=Regex("abcdef{:[[ghi]]:[{op},{q}]}", ":\[\[]\([^\]]*)\]", "[\1]");It doesn't work either:
c=Regex("abcdef{:[[ghi]]:[{op},{q}]}", ":\[\[]\!007B([^\]]*)\]", "[{\1]");