Moritz
December 6, 2019, 9:44am
1
Hello Everyone,
i have a problem, and i can´t wrap my head around how to solve it.
My data looks like this:
0.2
0.3
0/F
0.3/F
I want to replace the whole cell, which includes /F with a “?”.
I tried the string replacer node with a regular expression: "str=str.replaceALL(“0/F”) with the replacement text “?”. This does not work.
I also tried the string manipulation node with this expression: regexReplace($Col1$,"[/F]" ,"?" ).
This does not work either.
Anyone some tips or improvements?
Thanks in advance!
Moritz
HansS
December 6, 2019, 9:50am
2
Hi @Moritz
Did you try the String Manipulation node with:
replace($column1$,"/F" ,"?" )
gr. Hans
2 Likes
Moritz
December 6, 2019, 9:53am
3
Yes I tried it and it works, but only partially.
It replaces the /F with an “?”.
But in the case when the “/F” is behind a Number, it only replaces “/F” and not the whole cell.
/F = ?
0,22/F = 0,22
Thanks for the suggestion!
tommy
December 6, 2019, 10:03am
4
Hi @Moritz ,
what you need is checking if your column contains /F.
I suggest in this case a Rule Engine Node with…
$s$ LIKE “*/F*” => “?”
TRUE => $s$
However, there can be other approaches (i.e. Regex) which should also solve your problem.
Greetz, Tommy
3 Likes
Hi @Moritz ,
I agree with @tommy . Here is a single line expression (in the Rule Engine node):
$column1$ MATCHES "[\d\.]+" => $column1$
Using this expression, if the value contains only digits and dot, then it returns the same value, else it returns missing value (?).
2 Likes
ipazin
December 6, 2019, 12:21pm
6
Hi there all,
don’t have anything against regular expressions but I prefer wildcards if they are sufficient.
So expression in Rule Engine that does the job using wildcards would be like this:
NOT ($column1$ LIKE "*/F*") => "$column1$"
Br,
Ivan
1 Like
system
Closed
June 6, 2020, 12:32am
7
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.