RegexReplace

Hi, I am trying to find a regexpReplace statement to remove a dot followed by numbers.

I tried several things but it is too heavy for me. I tried
regexReplace($myString$, "(.*[0-9])\..*", "$1" );

image

Hello @knimerin
There are several ways to achieve the result without regex.

regexReplace($user pain$, "[.]\\d+", "")

If you want to handle it as a number; you can use a ‘String to Number’ and a ‘Math Formula’ node afterwards:

floor($user pain$)

As a text, you could also use a ‘Cell Splitter’ node with a dot as delimiter; retaining $user pain_Arr[0]$ column.

BR

4 Likes

Thanks for this solution. Worked pretty well. Is there also a regexReplace to get the last part of a string which is structured with “/” like:

DepartmentA\GroupB\MemberC

to get the MemberC? Note that it can have more ore less than 3 structures, like:

DepartmentA\MemD

Hi @knimerin

You can test:

regexReplace($text$,  ".*\\\\(.*)",  "$1")

it will return: “MemberC”

BR

1 Like

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