Does flowgrounds JSONata expressions support regex?

154 Views Asked by At

I'm trying to build a fairly complex expression with a CBR where I try to identify if a string contains another string. In order to do so I need to manipulate the second string and use a little bit of regex magic but it doesn't seem to work. Could anyone confirm if the JSONata implementation of flowground support regex inside a "contains" operation? The expression I am using right now is the following:

$not($contains(elements[0].attribs.content,"/" & $replace(elasticio."step_1".body.issue.fields."customfield_22519"[0],"-"," ") &"/i"))
1

There are 1 best solutions below

0
On BEST ANSWER

RegEx and $contains are working correctly in combination.
The reason for your not working expression is that the second parameter of $contains is a string (something like "/xyz/i"). This string is not being interpreted as a regex.

  • your expression: $contains( "abc", "/" & "X" & "/i")
  • to change in: $contains( "abc", $eval("/" & "B" & "/i") )