Regexp with inversion match

Hello, All!

I have some problem with building regexp in Row Splitter node.

The case is to select row with pattern matching using regexp.

First time I need to select all rows, containing the following patterns: "14", "15", "15a".

The regexp like 14|15|15a working good.

But I can't build regexp to matchin with inversion, i.e. needed to select all rows, which NOT contain the following patterns:  "14", "15", "15a".

I'm trying to use some like this:

!14|15|15a

!~14|15|15a

!(14|15|15a)

!~(14|15|15a)

(?!(14|15|15a))

But all of them did'nt work or not work properly.

How I can realize multiple invert selection with KNIME/Java syntax of regexp?

Thanks!

 

 

Aggle, hello.

Could you try "negative" filter node ?

Exclude rows by attribute value and use positive Regex.

Regards,

Demetrius.

Thank You, dfs.uerj!

it's first, that I do. It is simple and obvious brute-force way :))). But the column, needs to filtering, contain more then 50 different factors.

On the other hand, I need to negative select only 5-6 factors. Therefore, using "negative" mode all other factors must be set manually.

Aggle,

It's a nuisance, isn't it? For me the syntax on the following SO page tends to work:

http://stackoverflow.com/questions/1395177/regex-to-exclude-a-specific-string-constant

So instead of a single string constant put (string1|string2|...) and you're set. ^ and $ are non-optional.

Or,even simpler: Use the Column Splitter node and chosse the other outport. :-)

@KNIMErs: Doable workarounds notwithstanding, it *would* be nice to have column filtering using the same design pattern (i.e. include/exclude option) as the row filtering... 8]

Cheers,
E

1 Like
  • Column/String to exclude: ABC
  • Regex to use: ^((?!ABC).)*$
4 Likes