Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Removing text after a specific set of characters

steostro
5 - Atom

Hi,

 

I am looking to remove text after "_IN". What formula would be the best to do this?

 

Example:

Current text: WHP_B_AEL_TUBEMO_DSK_VID_PTUB_BHV_dCPM_30s_BKIN_IN_DADAND_EQU_EQU

Desired text: WHP_B_AEL_TUBEMO_DSK_VID_PTUB_BHV_dCPM_30s_BKIN_IN

 

The text after "_IN" varies so the formula would need to focus on removing anything after "_IN" as opposed to beginning with "DAD"

 

Thank you!

4 REPLIES 4
MSalvage
11 - Bolide

@steostro,

 

If you add a Regex tool set to Parse with the expression:

 

(.*\_IN).*

 

It should get you what you want.

steostro regex settings.PNG

 

Also, I have attached an example.

 

Best,

MSalvage

estherb47
15 - Aurora
15 - Aurora

Another method is to use a formula tool, and Regex_Replace. Here, [Field1] is the field that needs cleaning. This will separate the text into that which ends with the "_IN" and the rest of the text, and give you the first piece only.

REGEX_Replace([Field1], "(.*?_IN)(.*)", "$1")


Best, Esther

danrh
13 - Pulsar

You can also use a Formula tool with Left([Text], FindString([Text], '_IN')+3).

Surendar16
5 - Atom

How to remove text in Column headers after some specific characters like (-,_,).....

I have header like this below

 

Current - CBDS - FASTEST ROW

Expected like - CBDS

 

 

Labels