how to extract specific value using Rule-based Row Filter

help me please,

I need to extract 12 digits of numbers from a sentence, For example:
image
I just wanna take the first row, so on “Rule-based Row filter”,

i add
image

but the other rows also captured,

How to change another 8 digits (???) to number only? I already changed “?” to [0-9] but it did work,

Thank You

image

full picture

Personally, I’d use the Regex Extractor node with the expression [0-9]{12}

image

image

5 Likes

where I can get that node?

Hi @zulfikar12345 this is definitely something to use with Regex.

You can do regex with the MATCH expression in the Rule-based Row Filter. May be try something like:
$column1$ MATCH [0-9]{12} => TRUE
or
$column1$ MATCH "[0-9]{12}" => TRUE

1 Like

Hi @zulfikar12345

The Regex Extractor is part of the Palladian (community) nodes. See NodePit and the KNIME website how to install.
gr. Hans

2 Likes

Disregard my suggestion, I thought you only wanted to identify the rows that had 12 numbers (since you were using the Row Filter node, be it the Rule-based version).

If you want to extract as you mentioned (after I re-read the post carefully :joy: ), you can do this via String Manipulation or via the Column Expressions, or via the Regex Extractor from Palladian that was recommended by @elsamuel

1 Like

Thank you, i’ll try to download it

1 Like

Hi @zulfikar12345
Please try the following expression:
$Data$ MATCHES “^.1000\d{8}.$” => TRUE
I’ve applied this in both Rule-based Row Splitter and Rule-based Row Filter nodes, and both returns expected results.
Sample workflow looks simple:
image
Please find it attached.
Happy KNIMEing,
Kaz
Number_extractor.knwf (8.4 KB)

PS. You might need to install extra extensions or activate those already installed to be able to use MATCHES function.

2 Likes

Thank you so much, I have tried, it works perfectly.
:wink: :blush:

Thank You so much, I’ll try your suggestion. :+1:

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