String Manipulation - Regex expression

Dear all,
I’m trying to use the function:
regexMatcher($Company_Code$,"(?:COMPANY)"), by the String Manipulation Node.
All the Rows of the Column Company_Code are string like this:
“The COMPANY name is:NY”
In all the online regex editors working this expression works well, but non in KNIME. (The result is always “FALSE”)…
Ther’s some one that can help me ?
Thank You

Hi @maufer ,

welcome to the forum!

I am not 100% sure what you want to achieve, but whenever I see “RegEx” I think of the fantastic Palladian extension which comes with a Regex Extractor node. This let’s you play around and preview your RegEx.

For example to split the company name from the rest of the text the following RegEx worked for me:

(The COMPANY name is:)(.*)

This results in two columns with the matching groups which I then can use further down my workflow (e. g. delete the first matching group, filter on the second one, containing the company names.

These are eventually a few more steps than doing it all in the String Manipulation node, but maybe it helps.

See this example workflow (contains nodes from the free Palladian extension)


Thanks a lot for suggestions.
I’ll try this way sending a feedback.

1 Like

Hello @maufer,

what are you trying to achieve with regex and data from your company column?


**Dear Ivan,
I’m trying to match the substring “COMPANY” inside to the main string “bla…bla…bla… COMPANY…bla…bla…CODE…bla… bla…etc…”
I just used the string manipulation node with the subfunciotn regexMatcher(“column_name”, “(?:COMPANY)”, without TRUE results.
It seems very strange to me since the regexReplace(, , ) works correctly with the same regex expression.
Thanks for your interest.
Mauro **

Hello @maufer,

regexMatcher() function needs to match entire string in order to return TRUE. So following expression should do it:

However if you are only checking if there is COMPANY word in your strings you can use LIKE operator from Rule Engine node or contains() functions from Column Expressions node. Latter one can be used with if/else construction if more logic follows.


1 Like

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