Skip to main content
1-Visitor
May 4, 2018 3:06 PM UTC
Question

Regex in Thingworx

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?

2 replies

5-Regular Member
May 14, 2018 7:44 AM UTC

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

 

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

In js you defined regex via:

var regex = /bla/OPTIONS;

To escape the / does not work.

Translate