Alteryx Designer Desktop Discussions

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

Reg Ex tool Parse

berty
8 - Asteroid

Hi all, 

 

I'm still learning the regex tool and i'm struggling with something that is really simple:

 

i have this:

 

addressreg ex out 1reg ex out 2 
12 bobton lane12bobton lane
levi lane levi lane

 

i cant seem to get the right expression to show both examples ? could someone be so kind to explain how to split those out? - i'm sure its simple i'm just not writing the expression correctly

5 REPLIES 5
Amol_Telore
11 - Bolide

Hey @berty 

 

Here is my solution. Let me know in case of any concerns.

 

Amol_Telore_0-1658765537945.png

 

DataNath
17 - Castor

How does this look @berty? Because both of the addresses don't have a number element, even though you want to split that out if present, I've just made that capture group optional with the ? notation. By the way, this assumes the same address formats so let me know if they can differ or if this doesn't work when applied to a wider dataset and can look to amend it.

 

(\d+)?\s?(.+)

 

DataNath_0-1658765571602.png

berty
8 - Asteroid

@DataNath  - this was perfect,  i just found a little issue that I'm not sure how i configure this..

 

i have this address  77-79 yardman close and it seems to split like this 

77-79 yardman close77-79 yardman close

 

how can i get -79 added to field showing 77?

DataNath
17 - Castor

Hey @berty no worries - thanks for the example! Give this a try and again let me know if you come across any further issues :)

 

([0-9-]+)?\s?(.+)

 

DataNath_0-1658834492123.png

Amol_Telore
11 - Bolide

@berty Adding to @DataNath solution, I have created below regex code in case you get other character as well such as space or underscore in lane number. It will dynamically capture those details. 

(.+\d\b)?\s?(.+)

1. First capturing group : it will match everything till boundary of last digit. In this case it will be 77-79

2. Second capturing group : it will match remaining part as lane name.

 

Labels