New Knime user here and would like to get your advice.
What node can i use if i am trying to delete the characters after the second space?
I was looking at String Manipulation and Regex Split but I can’t find the right function or create the right pattern.
Appreciate your help.
FX SPOT CNY
FX FWD AED USD ON
IR CCSW KRW USD 12Y
If you just want to keep the first two group of characters, ‘String Manipulation’ node can do the job:
regexReplace($YourColumn$, "(\\S+[ ]\\S+).*", "$1")
Hi @gonhaddock ,
Thank you for this. Apologies, I am really new to using Knime and with little programming background.
Is it ok if I ask for some info regarding the regex code “(\S+\S+).*”
and the replaceStr “$1”
@untiverr , thanks for validating the solution.
You can type any code and test it in https://regex101.com/ ; in the right hand side bar it offers you a full explanation of your code step by step…
The $1 group replaces using the first group defined in between brackets within the code. As you can appreciate I just defined one group (1st capturing group) including the two first group of characters separated with a space, that’s it.
Despite the topic of the post, the solution is more about what you want to keep, rather that what you want to be deleted
With Regex Split, you would need to define two capturing groups…
(\S+[ ]\S+)[ ](.*)
Using this code in String Manipulation node (with double back slash), you can decide whether to keep $1 or $2
Hi @gonhaddock ,
Thank you so much for the added info and learning.
Really appreciate it!
And yes you are right, it really is more on what I want to keep.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.