Sandeep Thomas
Sandeep Thomas

Reputation: 4759

Splitting string based on delimiter Alteryx

I have a string like this

Abc\defg\hijk\lmn

My requirement is to get last part of the above string based on delimiter ****

I tried text to column tool and it needs more filtering and formulas.. I really believe there should be an easier method.

Upvotes: 0

Views: 1737

Answers (2)

Jamie Laird
Jamie Laird

Reputation: 21

Have you thought about using RegEx?

The following Regular Expression .*\\(.*) will return the part of the string after the last backslash.

Click here to read more about how this works or to adapt it for any particular constraints you have.

Use the RegEx Tool to implement this approach in Alteryx.

Click below to see some screenshots of how this will look in practice:

RegEx Tool configuration

Example workflow and results

Upvotes: 2

Degan
Degan

Reputation: 989

Following up the comment from @johnjps111:

one easy approach is to reverse the entire string, then take the first instance up to the given delimiter, then reverse that substring to achieve the desired result. Caveat: original string shouldn't be ridiculously huge

Here is one-step method to get your requested output, using Formula

Input: Abc\defg\hijk\lmn

ReverseString(Left(ReverseString([Input Text]),FindString(ReverseString([Input Text]), "\")))

Output : lmn

Upvotes: 2

Related Questions