Alteryx Designer Desktop Discussions

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

Extract Text from a String

rjesus1987
6 - Meteoroid

Hello,

 

Need guidance/expertise on how to extract a specific phrase/text from a string using a formula tool (eg. REGEX Replace).  I tried REGEX Replace ( REGEX_Replace([Question], '(\d+) .*', '$1') ) but can only get result 1 but having a hard time extracting result 2.

Based on the Question column, I need to show add to new columns (Result 1 & result 2)

 

QuestionResult1Result 2
1.1 What is your name1.1What is your name
2.11 Where do you live2.11Where do you live
3.1 What is the name of your 1st pet3.1What is the name of your 1st pet
4.15 How old are you4.15How old are you
2 REPLIES 2
Pilsner
11 - Bolide

Hello @rjesus1987 

I have given this a go using the Regex tool.

Screenshot 2025-03-19 181707.png

The statement used ([1-9\.]+)\s to get all numbers and decimal points, up to the first space.
The statement \s(.*) gets everything after the first space.

By setting the regex to Parse, you can get the two results columns you are after.

Please let me know how you get on.

Regards - Pilsner

binuacs
21 - Polaris
Labels
Top Solution Authors