We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Extract text up to 3rd - from a string

MAT_84
6 - Meteoroid

Hi, 

 

I want to extract part of a string in the following two examples:

Example 1: TE00939 - Test1

Example 2: TE009-9-3 - Test2

 

I know how to extract part of the string up to the 1st '-' and get the following result: TE00939 (from the 1st example).

But I'm not sure how to tell Alteryx to extract TE009-9-3 from Example 2. 

 

Any thoughts please?

5 REPLIES 5
apathetichell
20 - Arcturus

regex_replace([field],'^(.*)\s-\s.*$','$1')

Kottapally_Ramesh
7 - Meteor

Hi Mat,

you try any of the below functions in formula tool and attached sample workflow for your reference.

Trim(Left([Input], FindString([Input], " - ")))


REGEX_Replace([Input], " - .*", "")

jrlindem
11 - Bolide

@apathetichell's solution is the cleanest solution.

But for me, its Friday and regex hurts my head on most normal days, let alone the Friday before a Holiday (in the U.S.), so here's another option using a FORMULA + TEXT-TO-COLUMNS just for fun:

jrlindem_0-1756479488912.png

 

flying008
15 - Aurora

Hi, @MAT_84 

 

FYI.

Left([Txt], FindString([Txt], ' '))
MAT_84
6 - Meteoroid

thanks all! Still new to alteryx so trying to get my head around. I'll get there soon :)

Labels
Top Solution Authors