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.