Search for keywords in a couple fields (REGEX maybe?)

I’m trying to search for a certain list of keywords in column 1 or 2 and compare that to whether they are in columns 3 and 4. Here’s an example table. I’d like to look for the words “car”, “vehicle”, “auto”, not case sensitive, in these fields. The “Desired Result” column shows an example output.

Title 1 URL 1 Title 2 URL 2 Keyword Match
Car world The best cars 1 and 2
vehicle sales selling everything 1 only
friendly people automotive splendour 2 only
Best options friendly people None

I’m guessing that some version of regular expressions will help me do this, but I have so little experience with KNIME and no experience with regular expressions, so I’m struggling to figure this out. Any suggestions would be greatly appreciated!

You could use a Rule Engine node with the LIKE operator.Your rule could look like this:

($title1$ LIKE "*car*" OR $title1$ LIKE "*vehicle*" OR ...) AND ($url1$ LIKE "*car*" OR $url1$ LIKE "*vehicle*" OR ...) => "1 and 2"
($title1$ LIKE "*car*" OR $title1$ LIKE "*vehicle*" OR ...) AND NOT ($url1$ LIKE "*car*" OR $url1$ LIKE "*vehicle*" OR ...) => "1 only"

To simplify this, you can use the Rule Engine (Dictionary) node. It allows you to read the rules from a table, so you can generate them automatically and don’t have to enter them by hand.
Kind regards


Hi there @stevelp,

this topic might help. Also includes references to other same/similar topics as well.

Considering you have “no experience with regular expressions and little with KNIME” I don’t think a bit of learning would do any harm :wink: Apart from this community KNIME provides lot of resources here:

Good luck and if any questions feel free to ask!


1 Like

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