Split column string from Right space

Hi,
I am having values like
xyz abc 123
jkl uio opop 345
wer opl A0123

Now, I want to display the values
123
345
A0123
in another column.

Can anyone help me in doing this.

I tried using String manipulation with “lastIndexOf” and it is getting the number. But I need to last string
I also tried to cut the string from Right using space but unable to find it out.

I would appreciate the help on this

Hi,

This expression in String Manipulation node would do what you’re looking for:
regexReplace($column1$, ".* ", "")

Best,
Armin

4 Likes

Hi,

$[Column]$.substring($[Column]$.lastIndexOf(" ")+1) should return what you expected.

Best,
Hermann

Hi, This expression works perfectly. At the same time, I also want to have text values in another column i.e.,
xyz abc
jkl uio opop
wer opl
could you also help me where can I find these regex expressions to write?

$[Column]$.substring(0,$[Column]$.lastIndexOf(" "))

Dear @ngumpena,
To have both parts in separated columns, use Regex Split and input this pattern:
(.*(?= .*$))(?: )(.*)

Armin

EDITED: The previous pattern
(.* )(.*)
had a problem: The first group had a space at the end. Now the space which separates the first part and the second part (the last space) will not be caught.

5 Likes

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