Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

RegEX

DennyChan
8 - Asteroid

Hello all

 

I am starting with RegEx and have difficulty with RegEX parsing

 

I have UK address and  need to parse out road number  and postcode (US zip) for is AA## #AA

 

I have been able to parse out the number using (\d+)

I have been able to postcode out the number using ([[:alpha:]]{2}\d{2}\s\d[[:alpha:]]{2})

done these individually but can't do it on the same REGex tool, is there a or operator

 

what am i missing?

 

also, how do I get the road name to be parsed?

How can i use the Regex match to identify if data doesnt have a postcode?

 

DennyChan_0-1657624740358.png

 

MAny thanks

 

Denny

 

 

 

7 REPLIES 7
Amol_Telore
11 - Bolide

Hi @DennyChan 

 

You are almost there. You just need to provide multiple groups in regex expression to parse out multiple fields. Ex. One group for road number, one group for zip code and vice versa.

Number of output fields = Number of capturing groups (Non capturing groups will be excluded)

You can refer below configuration for your reference. And regarding road name, I did not find any road name in data.

 

Amol_Telore_1-1657629224122.png

 

 

PhilipMannering
16 - Nebula
16 - Nebula

@Amol_Telore Though not point in capturing a group and then ignoring it. You might as well replace (?:.*) with .*

binuacs
20 - Arcturus

@DennyChan another way doing this

binuacs_0-1657629779021.png

 

DennyChan
8 - Asteroid

Thanks @Amol_Telore

 

The address I am referring to is the words "address, another address and long long address" everything between the house number and postcode, need to parse as street name

 

 

many thanks

 

Denny

 

Amol_Telore
11 - Bolide

@DennyChan You can use below regex to parse all three information in parse mode. 

 

Regex Expression :-

(\d+)\s+(.*?)\s+(\w{2}\d{2}.*)

 

@PhilipMannering I tried your suggestion. Thanks for showing me this approach.! 

Emmanuel_G
13 - Pulsar

Hi @DennyChan ,

 

It's possible to extract both from one RegEx tool.

 

The main problem in yours is that the number at start of string is not recognized.

 

I re-edited your regex a bit to make it work.

 

To extract them, you put them in parentheses as you did before.

 

(^[0-9]+)\s.+([[:alpha:]]{2}\d{2}\s\d+[[:alpha:]]{2})

 

Cheers ! 

 

Emmanuel_G_0-1657630932627.png

 

MarqueeCrew
20 - Arcturus
20 - Arcturus

You might find this site useful:

 

https://regexlib.com/Search.aspx?k=Uk%20postcode 

 

better to find success in other peoples efforts

 

 cheers,

 

 mark

Alteryx ACE & Top Community Contributor

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