Escaping Doublequotes with Backslash Does not Work #urgent

I use a “table creator” to create a list of rules which are then fed to a “rule-based row splitter (dictionary)”

The rules are of the form:

$colname$="somevalue"    TRUE

I have created this setup multiple times already and it is working fine. However, some of the string values I need to compare contain doublequotes. According to the official documentation, they need to be scaped using a backslash. I tried that in various permutations, but it always fails.

Error message:

ERROR Rule-based Row Splitter (Dictionary) 0:228      Execute failed: 
java.text.ParseException: Line: 306: Expected: =>
$value$="2\"" => TRUE

Rule formating, I’ve tried, all failed:

$colname$ = 5"
$colname$ = 5\"
$colname$ = "5""
$colname$ = "5\""

According to the docs, the last one should be the correct syntax but it also fails with the above error code. What am I doing wrong?


If the column is a type of Number then you don’t need the double quotation marks.
$colname$ = 5
But if it’s a String then just simply input the double quotes without any backslashes like this:
$colname$ = "5"
This works if you are creating the rules in a table creator node.
If you were creating rules in some node like string manipulation using some function like join, then you would need backslashes before each mark surrounding the value ($colname$ = \"5\").


You didn’t understand my question. To clarify:
I am not interested in matching 5 but 5". So $colname$ = "5" doesn’t help me.

According to docs, the solution to my problem is $colname$ = "5\"" but it isn’t working. Either this is a bug or the documentation is incomplete/outdated. I assume there is some non-standard way to describe this, because a single equals sign is not commonly used to compare two values. Must be something KNIME specific that isn’t obvious and I’d like to know what it is.

Oh, Sorry.
In that case you have to use slashes instead of surrounding double quotes:
$colname$ = /5"/



I have slashes in the strings as well. I got it to work by writing a piece of python code. Thanks for pointing me in the right direction.

1 Like

For those slashes inside your string you can use a backslash to escape.
For example if you have a string like this:
5"some text/some other text/some other text
Then the rule would be like this:
$colname$ = /5"some text\/some other text\/some other text/


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.