Regex For Multiple Lines in Knime

Rachel Katz :

I am using Knime to find a pattern like AB1234 anywhere in the data of one of my columns X. X can have multiple lines in each cell but I can't figure out how to search all of the lines. Below is my current regex, can you please help me search all lines

I tried this first to search but it only matched if that pattern appeared in the first line of the cell, did not work for cells with line breaks:

.*?[A-Z]{2}[0-9]{4}.*

Then I tried to do this to search all of my lines but it didn't work and only searched the first line again:

(.*|[\r\n])[A-Z]{2}[0-9]{4}(.*|[\r\n])
Gábor Bakos :

You can use the inline embedded flag expression for multiline mode, (?m) and the embedded DOTALL flags, (?s) together:

Your first expression would look like this:

(?ms).*?([A-Z]{2}[0-9]{4}).*

Screenshot of the workflow

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=159373&siteId=1