Advent of Code is now back for a limited time only! Complete as many challenges as you can to earn those badges you may have missed in December. Learn more about how to participate here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Keep all characters to the left of a special character

cstafford
8 - Asteroid

looking for a way to keep all characters to the left of a special character and the character length will vary. I assume I RegEx would work but I am not very savvy with writing the correct formula.

 

Example

 

TEST_SAMPLE_1234   create a new column with TEST as the result

TRYTHIS_SAMPLE_12345  create a new column with TRYTHIS as the result.

3 REPLIES 3
DavidSkaife
14 - Magnetar

Hi @cstafford 

 

Assuming your first word will always be alpha only, and capitalised, a simple Regex Parse like below will work. There are alternatives if it's lowercase etc:

 

DavidSkaife_0-1677012972965.png

DavidSkaife_2-1677012989007.png

 

An alternative method is to use Text to Columns tool, with _ as the delimiter, split to two columns and then use a Select Tool to drop the extra:

 

DavidSkaife_3-1677013080479.png

 

Workflow with examples attached

 

RobertOdera
13 - Pulsar

Hi, @cstafford 

 

Below are some methods for you to consider.

 

Please mark it as a solution if it works for you - cheers!

 

RobertOdera_0-1677013393815.png

 

RobertOdera
13 - Pulsar

You're very welcome @cstafford!

Labels
Top Solution Authors