Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Extract text to the right of the last iteration of a specific character

cfranco
6 - Meteoroid

Need some help getting the text located to the right of a specific character.

 

For example, here are 2 records that I have:

C(I) , C(P) | C(I) , C(P) | C(I) , C(P) | C(I) , C(P) | C(I) , C(P) | C(I) , C(P) | C(I) , C(P) | C(I) , C(P)

C(I) , E(P) | C(I) , C(P) | C(I) , C(P) | C(I) , C(P) | C(I) , C(P) | C(I) , R(P) | C(I)

 

I need a way of extracting the text located to the right of the last " | ".

In the 1st record, the result should be "C(I) , C(P)"

In the 2nd record, the result should be "C(I)"

7 REPLIES 7
Thableaus
17 - Castor
17 - Castor

Hi @cfranco 

 

Yes, you can use REGEX to do this.

 

EDIT: Use Trim function to get rid of unnecessary spaces at the beginning and at the end of the string.

 

Trim(REGEX_Replace([Field], ".*\|(.*)", "$1"))

 

This should work.


Cheers,

geraldo
13 - Pulsar

Hi,

 

Follows a formula below

 

Right([TEXT],FindString(ReverseString([TEXT]), '|'))


[]

cfranco
6 - Meteoroid

I'm not that familiar with the REGEX tool.  Want to make sure I am using it correct.

I tried your recommendation but didn't get the expected results.  Here is the screenshot.  Can you clarify?

clipboard_image_0.png

cfranco
6 - Meteoroid

Thanks.  This worked.  I was not familiar with the "ReverseString" function.

Thableaus
17 - Castor
17 - Castor

Hey @cfranco you need to use it in a Formula Tool.

 

Like this

 

example1121.PNG

cfranco
6 - Meteoroid

Thanks.  I have a lot to learn and appreciate the support.

Thableaus
17 - Castor
17 - Castor

No worries @cfranco if you have any questions please let us know.

 

The Community is here to help.

 

Cheers,

Labels