Alteryx Designer Desktop Discussions

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

How to extract a part of a string in alteryx

Patricia2
7 - Meteor

Hi all,

 

Im trying to find a good formula to extract a part of a string based on 2 conditions, wherever in the string they can be. This means that the element I need is not located in a specific position of the string (that's why I can't use Text to Columns), but it always contains the term "Store" at the beggining, followed by a number. That whole term (store + number) is contained between to " _ " symbols. Is there any formula in Alteryx that could do this, despite where in the string that would be?

 

Thank you!!

2 REPLIES 2
grossal
15 - Aurora
15 - Aurora

Hi @Patricia2,

 

you can achieve this using the RegEx Tool.

 

grossal_0-1584452238707.png

 

Example: 

 

InputOutput
random asdfjklasdjfkl _Store939393_random textStore939393

 

Configuration:

 

 
 

AlteryxGui_nF9ROs2EH0.png

 

what does the expression do?

 

.* = some random stuff

_()_  = this is the instresting part, it starts and ends with underlines

and we are looking for a text inside the underlines, that contains "Store" and \d+ aka a number.

 

 

Workflow attached. Let me know if this helped.

 

Regards

Alex

 

 

 

 

 

Patricia2
7 - Meteor

It worked! thank you

Labels