cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

Discussions

Solve problems, and share tips and tricks with other JMP users.
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]");

Recommended Articles