Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

how to Extract String Value after final space

latte
5 - Atom

Hi, I have a STRING text of stock class information. I want to extract all the text digits or string alike after the final space. How do I do this? The Solution that I'm seeking to replicate is in the column Final Class. 

 

1) I'm able to use the Formula tool: Right([Name],FindString([Name],' ')) and extract some of the data from the right but it's not after the final space. 

2) I used a data cleansing tool to remove leading and trailing whitespace

3) Run another Formula Tool: GetRight([EXTRACT_CLASS], " ")  but I still can't get results to look like the values in Final Class column. 

 

There might be a regex tool solution but I haven't figured it out as I'm a bigger to regex and parsing such complicated string text. 

 

 

Thank you!

 

4 REPLIES 4
Bren_Spill
12 - Quasar

Hi @latte - you can use this regular expression to parse the data: .*\s(.*)

 

Regex.PNG

latte
5 - Atom

@Bren_Spill Thank you! your solution worked. Could you explain to me what the expression is doing? 

Bren_Spill
12 - Quasar

.*\s matches zero or more of any single character up until the whitespace. When the expression encounters the whitespace character, it backtracks to find the last occurrence of a space. 

 

The final .* returns the remainder of the string - this section must be placed in ( ) to create a marked group which will appear in the Output Columns section of the Regex tool

latte
5 - Atom

Thank you!

Labels