newbie help with regex in KNIME 3.3.1?

I am pretty new to KNIME and somewhat new to regex.

I am trying to extract phrases of the form "a number that occurs 1 to 3 words prior to a keyword". I have found / modified / tested expressions that do this and that return results I like in the various regex testing pages (for example, but I can't seem to get these to work in KNIME.


Not working looks like:

I put the regex inside double quotes in String Manipulation

regexMatcher($r_subject_text$, "\b[Dd]eath.*\b")


regexMatcher($r_subject_text$, "\\b[Dd]eath.*\\b")

returns False for every row, even texts that return full match in the test webseite.


Or, I run the text field through Strings to Document, then put the same regex into RegEx Filter (without the double quotes), and nothing is filtered out, even though I know there are hits in the corpus.


These tests lead me to belive that as a newbie, I am not looking at the right sequence of steps to find a True value for the Regular Expression and extract the matching text. 


I would deeply appreciate any pointers from the group.

Thanks in advance!



You seem to be close on getting the gist on regex (and Knime), not an expert really myself though:

The first regexmatcher you use, requires double backslash \\

and you need to define with e.g. .* preceding text. 

regexMatcher($Fulltext$, ".*(\\bdeaths\\b).*")

gives True in two cases (or [Dd] if you want upper/lower. I think there is also a token for ignore case btw).


Here is a really handy tool for regex syntax: