Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Return number of characters after a particualr character

cstafford
8 - Asteroid

I am curious what is the best to return a certain number of characters in a string. I usually use Left or Right, but in this case the RIGHT function will not work properly. Is there way to return all characters from the RIGHT up to a certain character, in this case the underscore.

 

 

Ex.

FRT_CNN_3

FRT_CNN_3R

 

I want to return the 3 and 3R, if I do right, 2, I get the underscore in the first example and I do not want that. However, is it possible to return all characters from the right after the underscore?

2 REPLIES 2
Thableaus
17 - Castor
17 - Castor

Hi @cstafford 

 

Using REGEX you can easily accomplish that.

 

REGEX_Replace([Field], ".*_(.*)", "$1")


Cheers,

Thableaus
17 - Castor
17 - Castor

@cstafford 

 

Another way of doing it:

 

Right([Field1], FindString(ReverseString([Field1]), "_"))

 

Using the Right function + other string functions.

 

Let me know if you have any questions.

 

Cheers,

Labels