Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Use Regex to Order Address

jagjit_singh
8 - Asteroid

Hi,

 

I have got addresses in the below format: suburb, street address, state, country. I like to order them as street address, suburb, state, country. How can I use regex to achieve the correct format please.

 

Anna Bay 16-18 Margaret Street NSW Australia

Ballina 106 Cherry Street NSW Australia

 

Required Format

 

16-18 Margaret Street Anna Bay NSW  Australia 

                                                                             

106 Cherry Street Ballina NSW Australia

 

 

 

 

Thanks

Jag

2 REPLIES 2
MarqueeCrew
20 - Arcturus
20 - Arcturus

How about?

 

 

Regex_replace([address],"(.*)\s(\d.*)\s(\w.*)\s(\w{3})\s(.*)","$2 $1 $3 $4 $5")

 

i parsed it into 5 groups. 

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
jdunkerley79
ACE Emeritus
ACE Emeritus

Very similar to @MarqueeCrew from me:

REGEX_Replace([Address], "(.+)\s([\d\-]+) (.*) ([A-Z]{3}) (\w+)","$2 $3 $1 $4 $5")
Labels
Top Solution Authors