Alteryx Designer Desktop Discussions

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

Parsing based on character

dan_b
7 - Meteor

Hello,

How do I parse a column based on the last character that separates a string? In the example below, i want to create a column that grabs Detroit and Holland. 

 

Region/CityCity
United States/Michigan/DetroitDetroit
United States/Michigan/West Michigan/HollandHolland
4 REPLIES 4
NicoleJohnson
ACE Emeritus
ACE Emeritus

This regular expression ought to do the trick, in the RegEx tool:

 

.*/(\w*)$

 

Output method should be Parse or Replace (if replace, designate $1 as the marked group you want to keep). Does that work for you?

 

Cheers!

NJ

Joe_Mako
12 - Quasar

Using (.*) as the capture group instead of (\w*) would capture all characters after the last slash, because sometimes a city has a space in its name, and the \w will return a Null in that case. See attached for example.

dan_b
7 - Meteor

Thank you! 

thompska
5 - Atom

how would I alter this process to put what is before the last slash into it's own column?  Using your example - take column Region/City and create 2 new columns - Region, City?

 

Labels