In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

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
Top Solution Authors