Missed the Q4 Fall Release Product Update? Watch the on-demand webinar for more info on the latest in Designer 24.2, Auto Insights Magic Reports, and more!
Free Trial

Alteryx Designer Desktop Discussions

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

RegEx help for matching alpha AND numeric

whitkrieng
8 - Asteroid

Hi all,

I've given up trying to test the right RegEx syntax for cleaning some raw Address values.  What I would to do is match non-standard values and NULL them.  So I would like to RegEx match any record that has an alpha AND numeric, not either or.  So Example is:

 

AddressClean_Address
poboxNULL
123NULL
pobox 123pobox 123
123 Sesame St.123 Sesame St.
.NULL
neededNULL

 

Any help would be greatly appreciated. Thank you!

6 REPLIES 6
grazitti_sapna
17 - Castor

@whitkrieng , Please find my solution and let me know if it helped.

 

grazitti_sapna_0-1667369465807.png

 

Sapna Gupta
flying008
15 - Aurora

Hi, @whitkrieng 

 

The formula for [Clean_Address] :

 

IIF(REGEX_CountMatches([Address], "\d") * REGEX_CountMatches([Address], "[a-zA-Z]") !=0,[Address], Null())

 

 

flying008_0-1667370025508.png

 

******

If it can help you , please mark it as a solution and give a like to here. 

binuacs
21 - Polaris

@whitkrieng One way of doing this

 

IIF(REGEX_CountMatches([Address], '\s') > 0, [Address],Null())

binuacs_0-1667374615444.png

 

whitkrieng
8 - Asteroid

@grazitti_sapna thank you so much

 

I was wondering if you could help translate for me what each part of the expression means just for my own learning purposes.  It's honestly been a bit of a struggle deciphering what works for RegEx: 

 

\d+\s[[:alpha:]]+.*

 

[[:alpha:]]+.*\s\d+

 

 

Thank you again!

 

grazitti_sapna
17 - Castor

@whitkrieng , In the first expression it is matching 1 or more digits followed with a single space and 1 or more alphanumeric characters and then any other characters in a string with .*.

Same goes for second string, it will look for 1 or more alphanumeric characters followed with space and then 1 or more digits.

Sapna Gupta
whitkrieng
8 - Asteroid

@grazitti_sapna Thank you for your response.  I realized in one scenario say it were just one string condensed together, it doesn't NULL the value.  Sorry I didn't put it in the original examples.  

 

For in this case: 

123SesameSt.

 

With no spaces, it appears to NULL. I would want to retain this due to the fact there is an alpha AND a numeric character in it. 

 

Thank you again!

Labels
Top Solution Authors