How to allow 'Missing Value' to be evaluated while using Regex ?

Hello everyone,
I am using regex in Column Expressions node for identifying alphanumeric values in a string column.
The problem is that there are missing values in the column for which KNIME throws the error

ERROR Column Expressions 0:12 Execute failed: (“NullPointerException”): null


I can clear out the missing values using the ‘Missing Value’ node or any other node like rule engine but the property of ‘Missing Value’ is being used in the flow later.

Hence I want a way to allow ‘Missing Value’ of KNIME to be parsed or evaluated using regex.


Hi @berserkersap , you can use an if condition in your column expression and pre-validate if it’s a missing value or not before applying your expression.

Assuming you want to ignore and leave as is for missing values, something like this should work:

if(isMissing(column("column1"))) {
} else {
    <your regex expression>

Thank You @bruno29a again ! Thank You for the fast reply.
This works. I didn’t think I would be able to use if loop in the Column Expressions since ‘if’ is not present in the functions list.

Hi @berserkersap , you are most welcome.

The reason why if is not in the function list is because, generally speaking, it’s not really a function.

And one of the reasons to use Column Expression is that it allows you to do both condition (if, switch/case) and manipulation, as opposed to Rule Engine that only allows you to do condition with no manipulation, and String Manipulation that only allows you to do manipulation. When you need to do both, that’s where Column Expression is useful.

1 Like

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