Skip to main content
Kinetic Community

Issue with Connector Expressions

In Kinetic Task 3.1.2 and later (including the 4.0 branch) there was a bug introduced dealing with connector expressions.  If a connector expression contains the $ character, an error will be raised and prevent the tree from being saved.  If a connector expression contains the \ character, it may be removed from the expression when saved. Unfortunately in Task 3, the Tree Builder will actually make it appear like the Tree has been saved but there will be an error on the back end that prevents it from being updated.  To confirm that this error is taking place check the Manager Log for Task 3 or Application Log for Task 4 and it will contain the following message. java.lang.IllegalArgumentException: Illegal group reference at java.util.regex.Matcher.appendReplacement(


Below is an example of a connector expression that triggers the bug (note that it contains both the $ and \ characters).

@answers['Attachment 1'].match(/\.png$/)

The expression shown above is using regex to see if the attachment file name ends with .png.  In this case, because there is a $ character, an error will prevent the tree from being saved.

Suppose we just removed the $ from the connector expression (shown below).

@answers['Attachment 1'].match(/\.png/)

In this case, the tree will be saved but the \ character gets lost in the process resulting in the following expression.

@answers['Attachment 1'].match(/.png/)

The backslash being lost changes the expression dramatically and in most cases renders it completely invalid.


The best solution is to fix the issue within Kinetic Task, and this will be done for the v3.1.4, v3.2.2, and v4.0.3 releases, but until then we can try to apply workarounds to avoid this bug.

Below are a couple of workaround examples, including one for the case above.


The example shown above (regular expression) is a common case where we might find $ and \ characters in the connector.  In regex the $ character is used to match the end of a line, in the case above we used it to determine whether or not the file name ends with a certain sequence. Ruby actually provides a built-in way to do this shown below.

@answers['Attachment 1'].end_with?('.png')

Since this expression does not use regex we can perform the same task as above without the use of the $ or \ characters.

Another case might be to add a $ to another variable.  In this example we are simply prefixing the Cost answer with a $ character.

"$" + @answers['Cost']

If we are using the $ in a String in the expression we can replace it with the ASCII representation.  Show below is an equivalent expression.

# 36.chr returns a dollar sign.  This is a workaround for a Kinetic Task bug
# dealing with dollar signs in connector expressions.
36.chr + @answers['Cost']

Note that there was a comment added to the expression because 36.chr is extremely cryptic and no one would know its purpose if it were not commented.  We would strongly suggest adding this comment wherever you use this particular work around.


If you have an expression that cannot be solved by the workarounds above please let us know and we will do our best to help you solve your case.