cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
john_madden
Level VI

Regex issue with escaped characters

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.

 

12 REPLIES 12
lwx228
Level VIII

Re: Regex issue with escaped characters

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!

 

lwx228
Level VIII

Re: Regex issue with escaped characters

  • I made a mistake.Writing code like this doesn't get you the right result.

  • c=Regex("abcdef{:[[ghi]]:[{op},{q}]}", ":\[\[]\([^\]]*)\]", "[\1]");
     
lwx228
Level VIII

Re: Regex issue with escaped characters

It doesn't work either:
c=Regex("abcdef{:[[ghi]]:[{op},{q}]}", ":\[\[]\!007B([^\]]*)\]", "[{\1]");