Skip to main content
1-Visitor
May 4, 2018
Question

Regex in Thingworx

  • May 4, 2018
  • 1 reply
  • 1874 views

Hi,

 

I have an regex (tested on regex101.com with javascript selected) and I get an exception

 

[message: SyntaxError: invalid flag after regular expression]

 

The regex:

/<mabasedata\s*(comment=\"([a-z0-9]*)\")+>/gi;

Text to parse

<MaBaseData Comment="abc">

Maybe this is a problem with the server-side javascript?

1 reply

5-Regular Member
May 14, 2018

Hi @drichter wondering if this also throws error for you?

 

\/<mabasedata\s*(comment=\"([a-z0-9]*)\")+>\/gi;
drichter1-VisitorAuthor
1-Visitor
May 28, 2018

In js you defined regex via:

var regex = /bla/OPTIONS;

To escape the / does not work.