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

Parse Address with commas in middle of address.

lbolin
8 - Asteroid

I am trying to parse address with a delimiter of a comma, I am using the text to column tool but i am running into a problem when there is a comma in the middle of the address. Example:

 

1300 Meridian Street,Suite 204,Huntsville,AL,35801,US

 

I want it to be :

130 Maridian Street Suite 204HuntsvilleAL35801US

 

It also shows up as:

1 Chase Corporate Dr. Suite 400,Ste. 6-200,Birmingham,Alabama,35244-1026,US

 

Also

5 REPLIES 5
clmc9601
13 - Pulsar
13 - Pulsar

Hi @lbolin,

 

How about this?

 

Screen Shot 2021-02-12 at 4.00.10 PM.png 

AkimasaKajitani
17 - Castor
17 - Castor

Hi @lbolin 

 

You can use RegEx tool.

 

AkimasaKajitani_0-1613214249820.png

 

Regular Expression:

(.+),(.+),(.+),(.+),(.+)

 

danilang
19 - Altair
19 - Altair

Very good solution @AkimasaKajitani 

 

Can you also explain why this works?  It will help others who aren't as familiar with regex?

 

Thanks

 

Dan

 

 

AkimasaKajitani
17 - Castor
17 - Castor

Hi @danilang 

 

For example, (.+),(.+) shows this result.

 

(.+),(.+)

 

AkimasaKajitani_0-1613263893361.png

 

+ is longest match. So the first (.+) shows this.

 

  1300 Meridian Street,Suite 204,Huntsville,AL,35801

 

Next shows this. 

 

  US

 

For the longest match pattern, search for the longest match possible.

 

 

On the other hand, Shortest match pattern is this(Add '?').

 

(.+?),(.+)

 

 

AkimasaKajitani_1-1613264064613.png

 

In this case, (.+?) pattern shows to first comma.

 

 

BretCarr
10 - Fireball

@lbolin 

I believe the REGEX expression should be a bit more specific to increase speed as well as handle that pesky extra comma:

 

(.+),(.+),(.+),((?:[\d-]{10}|\d{5})),(.{2})

Using parse method in the regex tool should take care of your issue!

 

Cheers!

Labels
Top Solution Authors