Extract specific value

Hi All,

Is there a node that can extract specific value with this kind of sample data

Corp Code Sample Output File
00C01 C01
00C03 C03
00C05 C05
00C07 C07
00C09 C09
00C11 C11
00C13 C13
00C15 C15
00C17 C17
00C19 C19
00C21 C21
00C23 C23
00C29 C29
00C36 C36
0BJ68 BJ
0CD68 CD
0CQ68 CQ
0CS68 CS
0DL68 DL
0GY68 GY
0GZ68 GZ
0HO68 HO
0HZ68 HZ
0NJ68 NJ
0SH68 SH
0SZ68 SZ

Thank you!

Hi @seanmanzanilla ,

If I look at the pattern from your sample data, it looks like there are 2 patterns:
00XXX and 0XX68

Are these the only 2 patterns that your whole data has? Or is this a case where we provide a solution and then you come back with other patterns? :slight_smile:

EDIT: Here’s a quick solution:
image

Input (Same as yours):

Results:

Here’s the workflow: Extract value based on pattern.knwf (6.9 KB)

2 Likes

Alternatively you could also use regexreplace in column expressions

I guess we all love KNIME because there is always more then one way to skin the cat
br

1 Like

Hi @bruno29a @Daniel_Weikert ,

Thank you for your great idea’s, really appreciated. And both works,

I like how regex works, Right now I’m still studying regex formula in udemy.

Hi @seanmanzanilla @Daniel_Weikert , using regex is definitely interesting and another way to do this.

I chose to use substr() instead because in this case, it’s positional enough, and should be faster than regex.

1 Like

Hi @seanmanzanilla , @bruno29a
there are always more then one way to solve it. And to be frank I would always go with @bruno29a solutions here in the forum. They are well explained, get the correct result and include the workflow. The time he dedicates here in sharing knowledge and helping people is highly appreciated. Kudos

I would not necessarily use regex if not needed because not everyone understands them. (I just love them :wink: and like to contribute here from time to time as well
best regards and enjoy your weekend guys

5 Likes

Thanks @Daniel_Weikert , you are too kind :smiley:

2 Likes

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